datetime question

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Nov 8 22:29:22 CET 2013


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

-- 
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence




More information about the Python-list mailing list