How to convert Date stored in Long Integer format to mm/dd/ccyy

G

Guest

In my Access Database, I have a date in a field with Data Type Number(Long
Integer) in Access. I need a function to convert this Long Integer to a
regular Date Format (mm/dd/ccyy)
 
D

Dirk Goldgar

Thek said:
In my Access Database, I have a date in a field with Data Type
Number(Long Integer) in Access. I need a function to convert this
Long Integer to a regular Date Format (mm/dd/ccyy)

How is the data represented in the Long Integer field? If it's in
mmddyyyy format (e.g., today as 02172006), then you could use an
expression like this:

CDate(Format([YourField], "00/00/0000"))

For example, in the Immediate Window:

?CDate(Format(02172006, "00/00/0000"))
2/17/2006

If your date is represented as yyyymmdd, then use

CDate(Format([YourField], "0000/00/00"))

For example:

?CDate(Format(20060217, "0000/00/00"))
2/17/2006

This may be dependent on your regional date format, as defined in
Control Panel. I'm not sure, but you can test to find out easily
enough.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top