import
datetime
in my django views to save the time in database
and
now = datetime.datetime.now()
when i am saving its value in database it returns something like
2013-04-28 22:54:30.223113
how can i remove
223113 from 2013-04-28 22:54:30.223113
part please suggest how can i do this ...
You should ideally be using datetime field in your database. But if there is a constraint that you go to store date as a string use this to format it :
>>> datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
'2013-04-29 12:17:55'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With