Skip to main content

Posts

Showing posts from February, 2009

Converting a string (dd/mm/yyyy) to a date in MS Access

For the best result in an MS Access query split the string into segments and use the DateSerial function:

GMTDate: IIf([GMT_Date]="",Null,DateSerial(Mid([GMT_Date],7,4),Mid([GMT_Date],4,2),Mid([GMT_Date],1,2)))

where dates are written in the format dd/mm/yyyy (23/12/2008).

When combining date and time fields from string use DateSerial + TimeSerial, e.g.

GMTDateTime: DateSerial(2008, 9, 23) + TimeSerial(10, 39, 1))