How to Change the date format

1,782 views
Skip to first unread message

Sanjeet Kumar

unread,
Feb 13, 2012, 2:40:13 AM2/13/12
to web2py-users
Hi to all,

I want to change the date format during the insertion in database
default is YYY-MM-DD but i want to insert in database by using the DD-
MM-YYYY and Month should be in the 'jan' format .

Please help me

Manuele Pesenti

unread,
Feb 13, 2012, 2:49:27 AM2/13/12
to web...@googlegroups.com

Rahul

unread,
Feb 14, 2012, 1:50:04 AM2/14/12
to web2py-users
Hi ,

import datetime
now = datetime.datetime.now()

#You probably need something like below --
date = now.strftime("%d %b %Y")

Some more cool and excellent Date manipulation and display tactics
at:
http://www.saltycrane.com/blog/2008/06/how-to-get-current-date-and-time-in/


Regards, Rahul D (www.flockbird.com)


On Feb 13, 12:49 pm, Manuele Pesenti <manuele.pese...@gmail.com>
wrote:
> http://docs.python.org/library/datetime.html#strftime-and-strptime-be...
>
> :)
>
>      M.

Sanjeet Kumar

unread,
Feb 14, 2012, 5:01:34 AM2/14/12
to web...@googlegroups.com
Thanks

Sanjeet Kumar

unread,
Feb 14, 2012, 5:01:54 AM2/14/12
to web...@googlegroups.com
Thanks
Reply all
Reply to author
Forward
0 new messages