How can we solve the datetime problem by moving the access database from the working server to the live one

Can you advise the best way to fix time zone problems in .Net. I recently developed a simple site using asp.net C # as codebehind and MS Access as a backend.

My production server and the servers are in different time settings. Product Server Date Format - dd-mm-yyyy

live server format is mm-dd-yyyy.

I encountered an error when trying to use date-time at the front end. "The string was not recognized as a valid DateTime."

The date that I am trying to fulfill was filled in on my working server, it works fine on the working server. but when I click the access file on a live server, I encounter the above error. any help would be much appreciated

+3
source share
6 answers

this is what I ALWAYS do while working with datetime in my interface: specify my own exact format (usually it is DD / MMM / YYYY - so I am sure that my daily part is always a numeric, monthly line and the year part 4- significant number

also USE DateTime.ParseExact instead of DateTime.Parse. thus, there is no ambiguity with the front end code.

One more tip - if you are using C # 3.5, I would recommend that you create an extension method in the datetime class, where you actually HARDCODE your specific format for this application, and then instead of delivering your format to 10 different places where you convert, just make a call to this extension method

, - , : -)

+1

, DateTime / - , .

+2

ISO - YYYY-MM-DD. , ZERO, MS .

+2

, #, VB ( Access)

myNewDate = cdate ( (DateIn, "mm/dd/yy" ))

0

, .

, , //qa , , , .

0

/ Access mm/dd/yyyy .

0

Source: https://habr.com/ru/post/1705878/


All Articles