Date Format

P

Pjdelchi

I have another easy one for you guys. I need to convert 20100805 to a date
format of 08/05/2010. Any suggestions?
 
P

Pieter Wijnen

dependant on wether you want it inUS or UK 08/05/2010 <g>
CDATE(Format(MyField,"0000-00-00")

should do it

Pieter
 
P

Pjdelchi

Thanks for the quick reply Pieter. I have already tried this one and it did
not work. I keep getting a "data type mismatch" error. The initial data
that I am tryign to convert to a date is a number so I even tried your
suggestion with #'s instead of 0's. This did not work either. I am
trying to get this to load in the US format of 08/05/2010.

Do you have any other suggestions? Should my field properties be adjusted
in some way?
 
F

fredg

I have another easy one for you guys. I need to convert 20100805 to a date
format of 08/05/2010. Any suggestions?

As a US date (Aug 08 2007)??

As long as the number always contains 8 characters:

DateSerial(Left([FieldName],4),Mid([FieldName]5,2),Right([FieldName],2))
 
P

Pjdelchi

Thanks Fred, but this did not work either. I need the format to be
08/05/2010 (Aug 05, 2010). I am still getting the "data type mismatch"
error.

fredg said:
I have another easy one for you guys. I need to convert 20100805 to a date
format of 08/05/2010. Any suggestions?

As a US date (Aug 08 2007)??

As long as the number always contains 8 characters:

DateSerial(Left([FieldName],4),Mid([FieldName]5,2),Right([FieldName],2))
 
J

John W. Vinson

I have another easy one for you guys. I need to convert 20100805 to a date
format of 08/05/2010. Any suggestions?

If this is a Number datatype field, try

DateSerial([yourfield] \ 10000,( [yourfield] MOD 10000) \ 100, [yourfield] MOD
100)

Set the Format property of this calculated date to mm/dd/yyyy (or use the
expression in an update query to set the value of a date/time field).

John W. Vinson [MVP]
 
Top