I am facing a problem for past two days with regard to the date format in SQL.
I have developed a application in ASP.NET and have deployed it in production server. I am persisting data into a table which has an xml column with date feilds like
---some date time---
When I run the application from localhost ( or deploy the application in my computer) the date is persisted in in 24 hours time format
For eg :15/08/2009 14:30:00
and when I run the same application deployed in the production server the data is persisted in 12 hours time format
For eg: 15/08/2009 2:30:00 PM
Note: I am not specifying any format in the application code when persisting data.
The following is what I have tried :
Checked regional settings of my computer and the webserver and format is the same (h:mm:ss tt)
Have checked the culture info of both my computer and webserver and it is the same. (en-AU)
In my computer's IIS Properties I have set the same culture of the webserver by Editing the configuration.
The dates in date columns of the same table are stored in consisntent format (24 hr format) when persisted from both my computer and the production webserver.
For eg: 2009-10-28 14:00:49.000
Still the date time is stored in different formats. I am unable to figure out from where the application is taking the format when persisting.
I finally found the root cause for this problem. I would like to post it just in case someone faces this same problem this might help them.
Go to regedit. Select Controlpanel -> international -> sTimeFormat and verify the time format given.
In my computer, the time format is HH:mm:ss and in server it is hh:mm:ss tt that was the main problem. I have changed the format in server to HH:mm:ss and it works perfect :)
Please refer to this link for details.
Try add the following to the web.config of your website:
<system.web>
<globalization culture="en-ZA" uiCulture="en-ZA"/>
</system.web>
Replace "en-ZA" with the specific culture you require. The will ensure that the browsers culture settings will not be used.
Related
i'm supposed to version the records in a database by year. so if i get a new file from the year 2023 the entries should be changed according to the year. i'm not finding anything useful to versioning data. in most cases, they use timestamps.but i'm not supposed to version the data by a specific timestemp but by the year the data is from. the data can be changed each year and according to the year the records should be modified.
i'm working on java with jpa, spring boot, spring web, h2 database and spring batch
Below option may be useful.
When you save the timestamp, then whenever required you can fetch and extract year part from the timestamp, ignore other components of the timestamp (day, month, time) and use it in comparison against year.
You can add additional customized column to store year.
data source = dateTime 2016-02-26 00:00:00.0
dss return = dateTime 2016-02-25T09:00:00.000-03:00
I would like to know if there is any settings to be made in the tool itself.
Let me briefly explain what you have received from the WSO2 Data Services Server (DSS).
It's not subtracting some hours from the date stored in your database. Actually, DSS server appends time zone information to your date fields.
Do you really want your date fields without time zone information? At the moment, I would like to suggest (as a workaround ) manually remove time zone information once you receive the response from the DSS server.
In the meantime, I have raised a public JIRA [1] regarding this issue and will notify the progress of it via this question.
Thanks,
Upul
[1]. https://wso2.org/jira/browse/DS-1191
I'm trying to understand why dates stored in my MSSQL server are being altered back one hour when I view them in JSON format.
Here is the Datetime date stored in MSSQL
2015-08-12 00:00:00.000
Here is debug mode in Visual Studio showing that the date "appears" to be retrieved correctly from the database.
{8/12/2015 12:00:00 AM}
And here is the JSON output - the date is one hour earlier! I see that the json timezone is -6, and the database timezone doesn't appear to have that, but I don't have any special settings in my web api config. I'm really not understanding what is going on here. Appreciate any help.
"2015-08-11T23:00:00-06:00",
Edit: My pictures didn't show up so I edited to show the dates in text format - hope that is allright.
When moving to OData V4 (from earlier versions) one of the first 'hickups' we run into is that V4 does not support 'DateTime' but 'DateTimeOffset'. In .Net terms we're moving from a "Date assumed to be in locale timezone of the server running it" to "DateTimeOffset" which explicitly included the timezone information itself.
OWin will emit the DateTimeOffset based on your thread's culture info. Your solution will then lie in making sure when converting between "DateTime" and "DateTimeOffset" (DB/EF and OWin respectively) that you don't rely on your local thread's locale setting, but force it to be considered UTC.
I not 100% sure why this is happening, however, the issue I am having is that I have a very simple date input which works perfectly fine on my home server (generates a dropdown list of Years, Months, Days). When I upload it to a remote server, an input field appears instead of a dropdown.
On the remote server I have tried both DATE and DATETIME fields in the database both producing the same results.
Here is the basic code:
echo $this->Form->input('event_date');
The version of cake is 1.3 (if that makes any difference).
Just remove all the files in your app/tmp directory.
Cakephp will take the structure of tables to the cache.
Whenever you are making changes to database table structure, you have to clear the cache.
I have installed Lucid Work Enterprises and notice that its displaying time of UTC zone. But my system timezone is UTC+05:30. so there is always a difference in my database last_modified field value for delta query for indexing (as there is 5:30 Hrs difference in Lucid admin timezone and my database timezone).
I tried to change a setting in start.bat file from
"set MISC_OPTS2=-Duser.language=en -Duser.country=US -Duser.timezone=UTC -Dfile.encoding=UTF-8"
to
"set MISC_OPTS2=-Duser.language=en -Duser.country=US -Duser.timezone=UTC+05:30 -Dfile.encoding=UTF-8"
But it doesn't make any difference.
I am unable to find a way to change timezone setting in Lucid admin area. Even there was no option to select timezone in installation wizard.
Please help me that how i can change this timezone setting for Lucid.
Thanks in advance
I had a similar issue using lucen/solr (without LWE). At solr ther is (also) no way to configure the timezone. Asking an Partner from "Lucid imagination" how to handle time-zones with lucene/solr, i get the answer: change timezone-settings at your J2EE servlet container options.
But as you said:
But it doesn't make any difference.
My workaround is realized by the application, which handles the "time-zone-difference" between lucene- and database timestamp. Not sure, which programming language you are using. PHP for example provides nice build-in functionality for handling dateTime objects and different timezones.