Before getting the value you must check of its types which type is you can not find the difference between DateObject-StrObject so you have to have same kind of datatype second thing open your terminal write python >>import datetime >>help(datetime) which will list you all the function. there is one function strftime() to format your date. so you can discard nanoseconds >>result=date1-date2
On Dec 2, 10:50 am, humanstalker <[EMAIL PROTECTED]> wrote: > Hi > > Just thought i would help out anyway even though this is solved. > > d = datetime.datetime.now() - datetime.datetime.strptime > (dbValueHere,"%Y-%m-%d") # Does a date diff between today and the date > from the DB, change "%Y-%m-%d" to suit the format of you string.Also > make sure you set the dbValueHere or replace it with you own value. > > print d.seconds # Prints the seconds > print d.days #Prints the days > > This allows you to get the days and seconds , its not much different > than the other solutions presented. > > ~stalkerh --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---