Change a numeric field to a date

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field of type long integer storing numeric dates as yyyymmdd eg
20040901.

I want to display these as ddmmyyyy. Is there an easier way than what I
have done below?

DateSerial(Left([tbl_Discounts]![DATE_END],4),Left(Right([tbl_Discounts]![DATE_END],4),2),Right([tbl_Discounts]![DATE_END],2)

Bruce
 
Your expression is close to what I would suggest except:
DateSerial(Left([tbl_Discounts]![DATE_END],4),Mid([tbl_Discounts]![DATE_END]
,5,2),Right([tbl_Discounts]![DATE_END],2))
 
I haven't timed the two, but you could also use

DateValue(Format(20040901,"@@@@-@@-@@"))

I'm not sure what either one will do with invalid values or nulls. I guess
testing would find that out.

Duane said:
Your expression is close to what I would suggest except:
DateSerial(Left([tbl_Discounts]![DATE_END],4),Mid([tbl_Discounts]![DATE_END]
,5,2),Right([tbl_Discounts]![DATE_END],2))

--
Duane Hookom
MS Access MVP

Bruce said:
I have a field of type long integer storing numeric dates as yyyymmdd eg
20040901.

I want to display these as ddmmyyyy. Is there an easier way than what I
have done below?

DateSerial(Left([tbl_Discounts]![DATE_END],4),Left(Right([tbl_Discounts]![DA
TE_END],4),2),Right([tbl_Discounts]![DATE_END],2)

Bruce
 
Back
Top