This may have been brought up before but I couldn’t find anything. I am pulling date/time from a SQL Server database using the classic asp server model. I then apply time formatting so it will read like 10:46:09 AM. I thought everything was fine until a client emails me and said all of their timestamps were displaying an hour off. Now, our server that this data comes from is in eastern time, and they are viewing it on a browser in Central time zone, but still, shouldn’t it pull the actual data from the database? I know about time zone when using the datepicker or inserting data, but I’m just displaying data from a Query. Also, when I take the formatting off, it looks like it is in UTC. I don’t mind the UTC format, but the time zone is off.
Example:
Pulling from plain classic ASP or PHP page:
10:46:09 AM formatting applied
2018-10-15 10:46:09.000 unformatted
From Wappler:
09:46:09 AM with formatting
2018-10-15T14:46:09Z unformatted
This is the formatting I’m applying:
{{TotalDoorTimeStart.formatDate(“hh:mm ss a”)}}
Is this normal? If so, how do I localize the formatting? I thought the date/time data would be exactly what is coming from the database.
I do not know if this is going to actually answer your question but it will help you to fix the issue.
In the data formatter options there are date formatter options for dateAdd which can be used for hours or minutes or days etc. When you use you use your date formatting at the same time use the dateAdd with a negative number to subtract an hour or a positive number to add an hour.
That should at least get you around the problem for now.
Thanks @psweb for offering that up. That’s what I’ve had to do as a work around. I am just curious though as to why my data is being changed though. Hoping someone from the team would be able to explain it. We deal a lot with timestamps and they have to be accurate.
The date format displayed on the page depends on the source date format (the one from your database).
Explanation: if your date is stored as 2018-10-15 10:46:09, it will show it the same way in server connect and wappler.
However it is different for a string like 2018-10-15T14:46:09Z which will convert to the timezone of the server or client, depending on where the formatter is being applied (server or client side).
The Z at the end of your date means this is an UTC time, so it is treated as an UTC time and what you experience is what it is supposed to happen with an UTC formatted date.
But my datetime is stored in the database as a datetime datatype like this:
Is there something happening during the query or the formatting process that I missing or doing wrong?
I just expect that If I have this in my database and I query that data and display it, I should get the same data. I understand if I have it stored as UTC, but doesn’t appear that is the case.
If you create a server action, with only a query listing the dates - when you click preview in browser button in server connect, what are the dates returned?