Link to home
Start Free TrialLog in
Avatar of jtequia
jtequia

asked on

Converting a numeric field into a date

I want to take a numeric 8 digit field that holds a number representing a date mmddyyyy, but where the month ranges from 1-9 the number is stored as mddyyyy.  I want to convert this into a date field in a query.
ASKER CERTIFIED SOLUTION
Avatar of Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Boyd (HiTechCoach) Trimmell, Microsoft Access MVP 2010-2015
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You can do a direct numeric conversion:


MyDate: DateSerial([YourNumField] Mod 10000,[YourNumField]\1000000,[YourNumField]\10000 Mod 100)

/gustav
gustav,

Great use of Mod

? DateSerial(9012011 Mod 10000,9012011\1000000,9012011\10000 Mod 100)
9/1/2011 

? DateSerial(CDbl("9012011") Mod 10000, CDbl("9012011")\1000000,CDbl("9012011")\10000 Mod 100)
9/1/2011 


? DateSerial(10012011 Mod 10000,10012011\1000000,10012011\10000 Mod 100)
10/1/2011 

? DateSerial(CDbl("10012011") Mod 10000, CDbl("10012011")\1000000,CDbl("10012011")\10000 Mod 100)
10/1/2011 

Open in new window

Yes, Mod is very useful in some cases.

/gustav