How to convert number to date (1 Viewer)

wgma

Registered User.
Local time
Today, 11:23
Joined
Nov 19, 2007
Messages
72
I have a number, 20080101, that I need to convert to 01/01/2008.

How do I do this? I am not familiar enough with access to know.

Thanks.
 

KenHigg

Registered User
Local time
Today, 12:23
Joined
Jun 9, 2004
Messages
13,327
cdate(mid(mystr,5,2) & "/" & right(mystr,2) & "/" & left(mystr,4))
 

wgma

Registered User.
Local time
Today, 11:23
Joined
Nov 19, 2007
Messages
72
WOW! that was fast.

Thanks.
 

KenHigg

Registered User
Local time
Today, 12:23
Joined
Jun 9, 2004
Messages
13,327
Send cash - :)

(just kiddin - glad to help)
 

stopher

AWF VIP
Local time
Today, 16:23
Joined
Feb 1, 2006
Messages
2,396
or (assuming digits 5&6 are the month)...

DateSerial(Left(mystr,4),Mid(mystr,2,2),Right(mystr,2))

Chris
 

agromerchant

New member
Local time
Today, 09:23
Joined
Sep 29, 2009
Messages
1
cdate(mid(mystr,5,2) & "/" & right(mystr,2) & "/" & left(mystr,4))

Hi Mr KenHigg..... please, what if I have 3 fields into 1 table, with NUMERIC data type: month, day, year...... but the month has only 1 digit....and I want to convert to date???
For exmaple, I have 28 - 9 - 2009 on the 3 numeric fields.
I have tried using cdate(mid,right,left) but does not work.....
What if I have Month: 10, Day:3, Year:2009?
Thanks in advance from COLOMBIA !!!!!
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 03:23
Joined
Jan 20, 2009
Messages
12,849
Bienvenidos.

When they are separate fields:
DateSerial([yearfieldname], [monthfieldname], [dayfieldname])
 

Users who are viewing this thread

Top Bottom