Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting the date format to output correctly

Status
Not open for further replies.

mlecho

Programmer
Aug 30, 2007
2
US
hi- in our db, the date is formated as : dd/mm/yyyy

the query is :
set news = cn.Execute("select * from news where content_language = 'French' and news_section = 'News' and active = 'Yes' order by post_date desc")

however, the output for something like christmas day is: 12/25/2008

i need it european (as the table is formated): 25/12/2008

what's happening there?
 
If the computer has a non-european locale, you will probably have to sort by an unformatted date, but show a formatted date.
 
what are the regional settings for dates in the OS?

A date is stored as a double where the integer portion is the number of days since 12/30/1899 and the decimal portion is the time. For instance, in Albuquerque, NM, today at 1:56 pm, the "date" = 39548.58055556

A formatted date (mm/dd/yyyy or dd/mm/yyyy) is a string representation of that number. The formatting is controlled by the date settings in the OS.

Access has formatting functions that you can use to force a particular format:
{typed not tested, syntax may be incorrect, check the Help for "format date"):
Code:
Format(DateField, "dd/mm/yyyy")

HTH


Leslie

In an open world there's no need for windows and gates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top