Hello.

I'm still working on an application that could be used potentially 
worldwide.
There is a lot of different ways to order the datetime data in the world:
https://en.wikipedia.org/wiki/Date_format_by_country
Anyway it could not be the language to set it, but the user must do it in 
his user profile.

The first version of this application is quite ready to go online.
I've worked on it formatting a datetime field like I would like to have it 
in my local country, dmY H:M.
Field('event_datetime', type='datetime', requires = 
IS_DATETIME(format='%d/%m/%Y 
%H:%M'), label=T('Start date and time')),

What could be the best way to manage this datetime field for managing it 
with different formats like Ymd H:M or mdY H:M format?

If I go to phpPgAdmin the field type is "timestamp without time zone", but 
when I display the rows in phpPgAdmin it's in Ymd H:M:s.
Example 2017-09-08 17:00:00.

So datetime is saved as a timestamp, but displayed as a Ymd H:M:s format.

In my web2py application, if I set IS_DATETIME on the field with a format, 
only one of the 3 format could be accepted.
For managing all 3 formats the only way that I can imagine is:
Delete the IS_DATETIME in the field:
Field('event_datetime', type='datetime', label=T('Start date and time')),

INPUT
Set this field as hidden in the form.
Add another field for the datetime input where I will let the user insert 
the datetime with the format that he have set.
Onchange on this field I change the value of the hidden event_datetime 
field as the standard format field.
OUTPUT
No problem I can format it as I want.

Is there a best way to do it?

Thanks, regards.
PS: I don't care of time zones as I get them by geolocalization.

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to