gingercat
Posts: 48
|
Posted: 01/29/2013, 10:56 PM |
|
I have a MS SQL database which stores dates in the following format in a DateTime field
2011-08-01 08:26:22.000
How do I set the DBFormat property for a label so the Date displays correctly?
The only default format I can get to work is yyyy-mm-dd HH:nn:ssGMT
But of course that doesn't really work because it assumes the dateTime is GMT and then adjusts the outputted date to compensate for GMT source Date/Time. by adding 13 hours to the time
We are located in New Zealand so have tried replacing the GMT with NZT ot NZDST but neither work and cause the field to display absolutely nothing.
If I leave the DBFormat blank it still seems to assume GMT and adjusts the time to compensate.
The locale for the project is set to New Zealand
|
|
|
saseow
Posts: 744
|
Posted: 01/29/2013, 11:27 PM |
|
I use something like this but there certainly may be a better way to do it. I have also tried a bunch of different ways but this, I found, was the easiest:
At the top of your PHP _events file for that page (ender the "Bind Events") put the following line:
ini_set("date.timezone","Asia/Riyadh");
Yours would be something like "Pacific/Auckland".
This saves you having to change the PHP INI file.
Hope it works for you.
|
|
|
gingercat
Posts: 48
|
Posted: 01/30/2013, 12:10 AM |
|
I can see what you're trying to do but our server is located here so the timezone is set correctly in the php.ini file.
I tried it anyway with no luck
|
|
|
beefcake
Posts: 11
|
Posted: 01/30/2013, 8:45 AM |
|
Try mssql.datetimeconvert = off
|
|
|
gingercat
Posts: 48
|
Posted: 02/03/2013, 3:16 PM |
|
In the end I found a couple of fields in the same table that had just date in one and time in the other. Using the separate Date field worked fine.
Not a fix tho - more of a workaraound
|
|
|