Please take a look at the documentation for the datetime and time modules :-)

>>> import datetime
>>> datetime.datetime.strptime('2008-09-16 08:01:16', '%Y-%m-%d %H:%M:%S')

-- Horst

On Fri, Nov 28, 2008 at 10:13 PM, Bobby Roberts <[EMAIL PROTECTED]> wrote:
> On Nov 28, 1:35 pm, "Horst Gutmann" <[EMAIL PROTECTED]> wrote:
>> If you convert timea into a normal datetime instance just substract
>> timea from timeb and you will get a datetime.timedelta instance which
>> has everything you need :-)
>>
>>     import datetime
>>     a = datetime.datetime(2008, 11, 15)
>>     b = datetime.datetime.now()
>>
>>     print b-a
>>
>> -- Horst
>
>
>
> Well I need to know the exact # of seconds from 2008-09-16 08:01:16
> to now.... not from just a date to date.  It has to be exact... does
> this make sense.  I was looking at this page
> http://pleac.sourceforge.net/pleac_python/datesandtimes.html   in the
> "Converting DMYHMS to Epoch Seconds" section.  I thought perhaps it
> would be easier to just get the epoch seconds between this time, and
> NOW() and subtract the two, however I keep getting an error locally in
> my terminal window reading:
>
>>>> import time
>>>> import datetime
>>>> t=datetime.datetime('2008-09-16 08:01:16')
>
> Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
> TypeError: function takes at least 3 arguments (1 given)
>
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to