datetime question

Νίκος Αλεξόπουλος nikos.gr33k at gmail.com
Fri Nov 8 17:01:37 EST 2013


Στις 8/11/2013 11:29 μμ, ο/η Mark Lawrence έγραψε:
> On 08/11/2013 21:11, Νίκος Αλεξόπουλος wrote:
>> 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.
>
> http://stackoverflow.com/questions/19774709/use-python-to-find-out-if-a-timezone-currently-in-daylight-savings-time
>
>


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?



More information about the Python-list mailing list