datetime question

  • Thread starter Îίκος Αλεξόπουλος
  • Start date
Î

Îίκος Αλεξόπουλος

Is there someway to write the following line even better with the
ability to detect daylight saving time by itself so i don't have to
alter the line manually when time changes?

lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime(
'%y-%m-%d %H:%M:%S' ) # MySQL datetime format

Thanks.
 
J

Joel Goldstick

rurpy? can you help?

Στις 8/11/2013 11:29 μμ, ο/η MarkLawrence έγÏαψε:


I saw the link and i'm wondering if it can be written in 1-liner.
Don't get me wrong but i had the lastvisit calculated on 1 statement and i
want to retain it this way.

Is it possible?
 
C

Chris Angelico

It's that global newline shortage again. Just because a few people
get killed in a newline mine they all go on strike...

It's a conspiracy! The government kills a few miners (with their
contrail mind-control stuffo) to push the price of newlines up, then
taxes us to the hilt and claims it's to fund development of artificial
newlines in labs! I tell you, man, those artificial newlines may LOOK
the same, but mark my words, one day they're all gonna rise up and
murder us in their sleep...

ChrisA
been up all night and is starting to get stupid
 
Î

Îίκος Αλεξόπουλος

Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγÏαψε:
Yes, but you have to rewrite all your code in perl to do this.


Please tell me and as a git i will provide you with 2 good pdfs i just
found:

You can see them at my website if you click the blue download button.

The 1st is a Linux Bile and the 2nd is WebHosting for Dummies.
 
R

Robert Kern

Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγÏαψε:


Please tell me and as a git i will provide you with 2 good pdfs i just found:

You can see them at my website if you click the blue download button.

The 1st is a Linux Bile and the 2nd is WebHosting for Dummies.

Please do not advertise your piracy site here. It is not welcome in this forum.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
 
C

Chris Angelico

Óôéò 9/11/2013 12:49 ðì, ï/ç Denis McMahon Ýãñáøå:



Please tell me and as a git i will provide you with 2 good pdfs i just
found:

You can see them at my website if you click the blue download button.

The 1st is a Linux Bile and the 2nd is WebHosting for Dummies.

Interesting. Your idea of a "gift" (quite different from a "git",
which is grammatically valid in your usage, though not what you
intended) is to offer something you stole AND which you're already
giving away to anyone who comes to your web site. This is your
incentive to us to write your code for you.

Actually, I think offering people free stolen bile for dummies is a
great business model. Nobody else is trying that!

If you want to offer something tempting, it's most likely going to be
money, and quite a bit of it, as stated in another thread. Plus,
you'll actually have to respect someone's design choices. Good luck on
that.

ChrisA
 
C

Chris Angelico

Why is Web Security for Dummies missing?

Because a Dummy can host a web (all you have to do is invite a spider
into your house and let it do the work), but he won't be able to make
it secure.

Or, more succinctly: Because it isn't.

ChrisA
 
Î

Îίκος Αλεξόπουλος

Στις 9/11/2013 2:45 μμ, ο/η Mark Lawrence έγÏαψε:
Why is Web Security for Dummies missing?


It's not missing.
Its there, check again.
Just click on the Blue download button and select it from the list of
buttons.
 
R

Roy Smith

Chris Angelico said:
It's a conspiracy! The government kills a few miners (with their
contrail mind-control stuffo) to push the price of newlines up, then
taxes us to the hilt and claims it's to fund development of artificial
newlines in labs! I tell you, man, those artificial newlines may LOOK
the same, but mark my words, one day they're all gonna rise up and
murder us in their sleep...

I only use organic, free-range, fair-traded newlines in my code. Have
you ever seen what happens on those big commercial whitespace farms?
The newlines are kept in justified lines, smashed up against the right
margin so close they can't even move, and forced to eat recycled EBCDIC
punctuation!
 
G

Gene Heskett

It's a conspiracy! The government kills a few miners (with their
contrail mind-control stuffo) to push the price of newlines up, then
taxes us to the hilt and claims it's to fund development of artificial
newlines in labs! I tell you, man, those artificial newlines may LOOK
the same, but mark my words, one day they're all gonna rise up and
murder us in their sleep...

ChrisA
been up all night and is starting to get stupid

Ya know, folks like Nick would have me signing off. Fortunately there are
kill files. But the backscatter he creates I am still forced to read, or
more usually skip.

This list recently has been far more about venting because GG is broken, or
Nicks un-teachability than about real code, by a large margin.

Then one of you frustrated standup comics comes along, and gives me a VBG,
and its suddenly all worth it. Thank You Chris.

Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

Hark, the Herald Tribune sings,
Advertising wondrous things.

Angels we have heard on High
Tell us to go out and Buy.
-- Tom Lehrer
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
law-abiding citizens.
 
C

Chris Angelico

Ya know, folks like Nick would have me signing off. Fortunately there are
kill files. But the backscatter he creates I am still forced to read, or
more usually skip.

Then one of you frustrated standup comics comes along, and gives me a VBG,
and its suddenly all worth it. Thank You Chris.

:) Don't just thank me, Grant and Roy were key to it too - and the
whole "there's no shortage of newlines" thing started with Steven
D'Aprano (I think), and it's a ripe field for harvest :)

But hey. If you're going to have to read backscatter, may as well make
it funny...

ChrisA
 
G

Gene Heskett

:
:) Don't just thank me, Grant and Roy were key to it too - and the

whole "there's no shortage of newlines" thing started with Steven
D'Aprano (I think), and it's a ripe field for harvest :)

And likely not fully gleaned yet. :) To all of you, thats some of the
better creative writing I've read in my 79 years. ;-)
But hey. If you're going to have to read backscatter, may as well make
it funny...
Precisely.

ChrisA


Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

A Difficulty for Every Solution.
-- Motto of the Federal Civil Service
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
law-abiding citizens.
 
C

Chris Angelico

And likely not fully gleaned yet. :) To all of you, thats some of the
better creative writing I've read in my 79 years. ;-)

Are you going to have a newyear after next year and start over with
Year 1 again?

ChrisA
 
G

Gene Heskett

Are you going to have a newyear after next year and start over with
Year 1 again?
Nah. I tried to put it off as long as I could, but times arrow, dammit,
only points forward. I might as well get used to it. From that famous
line about death and taxes, taxes will of course outlive me. Being a DM-II,
I of course haven't a shred of warranty left. Just up to pee and check on
that falling satellite, I could fall over walking the 20 feet back to bed,
but I'm going to do it anyway... ;-)


Cheers, Gene
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)

$100 invested at 7% interest for 100 years will become $100,000, at
which time it will be worth absolutely nothing.
-- Lazarus Long, "Time Enough for Love"
A pen in the hand of this president is far more
dangerous than 200 million guns in the hands of
law-abiding citizens.
 
Î

Îίκος Αλεξόπουλος

Στις 8/11/2013 11:11 μμ, ο/η Îίκος Αλεξόπουλος έγÏαψε:
Is there someway to write the following line even better with the
ability to detect daylight saving time by itself so i don't have to
alter the line manually when time changes?

lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime(
'%y-%m-%d %H:%M:%S' ) # MySQL datetime format

Thanks.


Someone has an idea what to add to this line to automatically adjust
itself if DST happens?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,930
Messages
2,570,072
Members
46,522
Latest member
Mad-Ram

Latest Threads

Top