date issue

L

Lapchien

A field in my db has a date value (actually a text field) as 20030202 (year
2003, month 02, day 02). Is there a bit of code that would turn this into
02/02/03?

Thanks,
Lap
 
N

Nikos Yannacopoulos

Lap,

Use Left, Right and Mid functions to get the year, day and month portions of
the string, and DateSerial function to convert those to a proper Access
date, or just plain concatenation if you just want a text string in the
desired format.
Look in Access's help o the use of the functions.

HTH,
Nikos
 
S

Steve Schapel

Lap,

You canuse the DateSerial function for this...
DateAsDate:
DateSerial(Left([DateAsText],4),Mid([DateAsText],5,2),Right([DateAsText],2))
 
L

Lapchien

Thanks - how would I use this in a query..?



Steve Schapel said:
Lap,

You canuse the DateSerial function for this...
DateAsDate:
DateSerial(Left([DateAsText],4),Mid([DateAsText],5,2),Right([DateAsText],2))

--
Steve Schapel, Microsoft Access MVP

A field in my db has a date value (actually a text field) as 20030202 (year
2003, month 02, day 02). Is there a bit of code that would turn this into
02/02/03?

Thanks,
Lap
 
S

Steve Schapel

Lap,

Type the full expression I gave you, substituting of course for your own
actual field name, into the Field row of a blank column in the query
design grid.
 
L

Lapchien

Thanks - it works very well!

Lap


Steve Schapel said:
Lap,

Type the full expression I gave you, substituting of course for your own
actual field name, into the Field row of a blank column in the query
design grid.
 

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