CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 DBFormat problem

Print topic Send  topic

Author Message
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
View profile  Send private message
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.
View profile  Send private message
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
View profile  Send private message
beefcake

Posts: 11
Posted: 01/30/2013, 8:45 AM

Try mssql.datetimeconvert = off
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.