Question : How to identify the correct globalization for date types ?

HI

I need to compare date values against an access database using asp.net (vb.net) but I am confused because the returned value from the following code "Dim hoy As Date = Date.Today.Date", seems to be dd/mm/yyyy but the database interprets it as mm/dd/yyyy.

How could standarize date values in order to make access interpret them always with the same format ?
Does this something to do with the language of access and server OS ?

I have noticed that if I use the wizard of MS Access and I put a date like dd/mm/yyyy the SQL edit mode shows it as mm/dd/yyyy.

regards.

Answer : How to identify the correct globalization for date types ?

Hi dimensionav,

Access interprets date values according to the local regional settings of the computer it is being run on but not for the SQL interpreter which "I believe" always uses "MM/DD/YYYY" format.

Best bet, IMHO, is to use the DateValue function in your code.

The DateValue function will interpret the date according to the local regional settings and pass the equivalent numerical value to the database (which is format independent).

eg.
UPDATE Table1 SET Table1.ExampleDate TO DateValue("dd/mm/yyyy")

If you need date and time then:
UPDATE Table1 SET Table1.ExampleDate TO DateValue("dd/mm/yyyy") + TimeValue("hh:mm:ss")
Random Solutions  
 
programming4us programming4us