Change Date Format from(YYYY-MM-DD) to (MM-DD-YYYY)

D

DustinS

I have a table in which the date is formatted (YYYY-MM-DD)

I need to request start and end dates from the user to query this table.

I wnat the user to be able to enter a standard US date format.


Any creative Ideas on how to handle this?

Thank you!
 
D

Douglas J. Steele

If this is a Date field, then the only reason the dates are displaying as
yyyy-mm-dd is because Regional Settings have been set to that. Access
doesn't actually store dates with a format: they're stored as 8 byte
floating point numbers (where the integer portion represents the date as the
number of days relative to 30 Dec, 1899 and the decimal portion represents
the time as a fraction of a day).

If the dates are stored in a text field, then you could try using the CDate
function to convert the strings to a date.
 
T

Tom Collins

Do you have a date field formatted like YYYY-MM-DD, or do you have a
text field formatted like YYYY-MM-DD?

If it's a date field then it doesn't matter how it's formatted. A date
is a date. It's stored as a number. For instance: today is 38440.
When the user enters the date in whatever format he wants (as long as
the system is expecting, and recognizes it as, a date) the system will
convert it internally to a number and do the comparison that way.

If you're storing it as a text field (seems strange) then you're
talking about a custom dialog box to get the dates, code behind to
convert it to YYYY-MM-DD, then build and execute a custom query.

Tom Collins


| I have a table in which the date is formatted (YYYY-MM-DD)
|
| I need to request start and end dates from the user to query this
table.
|
| I wnat the user to be able to enter a standard US date format.
|
|
| Any creative Ideas on how to handle this?
|
| Thank you!
|
|
 
D

DustinS

Gentlemen,
It is a text field in which the date is formatted yyyy-mm-dd , yes it is
weird! I ended up pulling it apart using (Left, Mid,Right) and then
concatenating it back together in the right order and formatting it as a
date!

Thanks for your help.
 
J

jchqkjjzhhszhx

http://www.saob.net/index.php?n=hsdy
Douglas J. Steele said:
If this is a Date field, then the only reason the dates are displaying as
yyyy-mm-dd is because Regional Settings have been set to that. Access
doesn't actually store dates with a format: they're stored as 8 byte
floating point numbers (where the integer portion represents the date as
the number of days relative to 30 Dec, 1899 and the decimal portion
represents the time as a fraction of a day).

If the dates are stored in a text field, then you could try using the
CDate function to convert the strings to a date.
 
Top