Language and development rules: Difference between revisions

Jump to navigation Jump to search
m
Tag: 2017 source edit
Tag: 2017 source edit
Line 495: Line 495:
For exemple le 1st january 1970, 3 hour at Paris (TZ=+1) = 2 hour at Greenwitch (TZ=0) will be stored into memory with value integer 7200 (2 * 3600s) and will be submitted into a SQL request to database into the string '19700101030000' (PHP convert the int into its TZ hour and database will unconvert it using its timezone too that is same than PHP).
For exemple le 1st january 1970, 3 hour at Paris (TZ=+1) = 2 hour at Greenwitch (TZ=0) will be stored into memory with value integer 7200 (2 * 3600s) and will be submitted into a SQL request to database into the string '19700101030000' (PHP convert the int into its TZ hour and database will unconvert it using its timezone too that is same than PHP).


*How to manage this for date with hours:*
'''How to manage this for date with hours:'''


So all insert or update methods must convert, during generation of SQL request, the integer memory date into a db string by using db->idate (you may find examples into skeleton).
So all insert or update methods must convert, during generation of SQL request, the integer memory date into a db string by using db->idate (you may find examples into skeleton).
Line 501: Line 501:
And all select methods should translate date fields, coming from the database as a string in TZ of server (here '19700101030000'), into a timestamp field (integer) by calling the method db->jdate(). So this stores the date into memory as a GTM Timestamp integer.  
And all select methods should translate date fields, coming from the database as a string in TZ of server (here '19700101030000'), into a timestamp field (integer) by calling the method db->jdate(). So this stores the date into memory as a GTM Timestamp integer.  


*How to manage this for date with no hours:*
'''How to manage this for date with no hours:'''


For insert/update, you must convert it with db->idate(value, 'gmt') so for 0, you will get '19700101000000'.
For insert/update, you must convert it with db->idate(value, 'gmt') so for 0, you will get '19700101000000'.

Navigation menu