Dates

  • Thread starter Thread starter JosephByrns
  • Start date Start date
J

JosephByrns

How do people cope with dates in multiple countries?

I have an Access database accessed by a VB.NET application, I construct
SELECT strings based on user inputs to get data from the Access database,
when entering a date value into the select string I use
date.ToLongDateString() to get an unambiguous date of the form 07 September
2006 (rather than 07/09/2006 which could of course be interpreted as
09/07/2006). Unfortunately it seems even the ToLongDateString method can
produce undesirable date strings in different countries, for example, giving
"Thursday, September 07, 2006" in US date format.

What are my options here?

Thanks.
 
¤ How do people cope with dates in multiple countries?
¤
¤ I have an Access database accessed by a VB.NET application, I construct
¤ SELECT strings based on user inputs to get data from the Access database,
¤ when entering a date value into the select string I use
¤ date.ToLongDateString() to get an unambiguous date of the form 07 September
¤ 2006 (rather than 07/09/2006 which could of course be interpreted as
¤ 09/07/2006). Unfortunately it seems even the ToLongDateString method can
¤ produce undesirable date strings in different countries, for example, giving
¤ "Thursday, September 07, 2006" in US date format.
¤
¤ What are my options here?

For a Microsoft Access database you can only use U.S. formatted dates in a SQL statement.
International date formats are not supported.


Paul
~~~~
Microsoft MVP (Visual Basic)
 
Your best option is to use a parameterized query and not have to format the
date at all. Assign a DateTime object to the parameter's value and execute
the query. Instant internationalization without the fuss.
 
It is actually the US date format that is ruining my Search string at the
moment, the UK string works fine.

I think I will have to go with a parameterized query as suggested below.

Thanks.
 
Without a fuzz?

Hmm, i'm always using ....TooaDate() otherwise it won't work..
 
Joseph,

In a SQL or Access database is the dateTime not done in any culture format.
It are ticks, starting at the moment the Brithish Empire started the
Georgian Calendar.

To use dates in a database have a look at this sample. Because the date in
numbers is written in Brittain the same as in Holland (not in characters),
you don't have to change much.

http://www.vb-tips.com/dbpages.aspx?ID=550279ec-6767-44ff-aaa3-eb8b44af0137

I hope this helps,

Cor
 
Back
Top