date and datetime form field SQLFORM() and SQLFORM.grid() format

91 views
Skip to first unread message

黄祥

unread,
Sep 28, 2021, 7:13:49 PM9/28/21
to web2py-users
hi, 

html form field date in web2py form (2.21.1-stable version) is showing format DD-MM-YYYY expected YYYY-MM-DD
tested using datetime is same, showing DD-MM-YYYY HH:MM:SS expected YYYY-MM-DD HH:MM:SS
tested using SQLFORM() and SQLFORM.grid()
both tested using chrome and firefox

is there any way to fix it ?

thanks and best regards,
stifan

Massimiliano

unread,
Sep 29, 2021, 4:14:33 AM9/29/21
to web...@googlegroups.com
you can pass your format to IS_DATE or IS_DATETIME validator

..., requires = IS_DATE(format=T('%Y-%m-%d'), error_message='must be YYYY-MM-DD!')

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/18b4ebe6-5a23-4302-af43-355fe56caf65n%40googlegroups.com.


--
Massimiliano

黄祥

unread,
Oct 10, 2021, 6:14:17 AM10/10/21
to web2py-users
root cause is on translation, correct it on languages folder
thanks
Reply all
Reply to author
Forward
0 new messages