date issue

  • Thread starter Thread starter Lapchien
  • Start date Start date
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
 
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
 
Lap,

You canuse the DateSerial function for this...
DateAsDate:
DateSerial(Left([DateAsText],4),Mid([DateAsText],5,2),Right([DateAsText],2))
 
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
 
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.
 
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.
 
Back
Top