formated local time

Nikola Skoric nick-news at net4u.hr
Fri Nov 16 08:48:02 EST 2007


Dana Thu, 15 Nov 2007 10:12:11 -0600, 
Adam Pletcher <adam at volition-inc.com> kaze:
>> -----Original Message-----
>> From: python-list-bounces+adam=volition-inc.com at python.org
>> [mailto:python-list-bounces+adam=volition-inc.com at python.org] On
> Behalf
>> Of attn.steven.kuo at gmail.com
>> Sent: Thursday, November 15, 2007 9:56 AM
>> To: python-list at python.org
>> Subject: Re: formated local time
>> If you want the formatted string, you can use strftime:
>> 
>> >>> time.strftime("%Y-%m-%d %H:%M:%S")
>> '2007-11-15 07:51:12'
>
> datetime also has the strftime method:
>
> import datetime
> datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')

Thanks everybody!

-- 
"Now the storm has passed over me
I'm left to drift on a dead calm sea
And watch her forever through the cracks in the beams
Nailed across the doorways of the bedrooms of my dreams"



More information about the Python-list mailing list