andr3w266
01-19-2007, 06:57 AM
hi all
I'm using MS Access 03 to run some queries on a SQL database. 2 of the columns i pull from SQL are about time, but are stored in 'unix time'. can this be converted once in Access to a more readable format eg ddmmyyyy?
any help would be much appreciated
mhartman
01-19-2007, 08:00 AM
Hello: Use the DateSerial Function
DateSerial Function
Returns a Variant (Date) for a specified year, month, and day.
Syntax
DateSerial(year, month, day)
The DateSerial function syntax has these named arguments:
Part Description
year Required; Integer. Number between 100 and 9999, inclusive, or a numeric expression.
month Required; Integer. Any numeric expression.
day Required; Integer. Any numeric expression.
'
Regards
Mark
namliam
01-19-2007, 08:37 AM
I am sorry DATA but you probably dont know Unix anymore beeing so far from the future ;)
IIRC (google for it!) unix time is the number of seconds that expire since januari 1st 1970.
So what you (need to) do is take that time /60/60/24
This will return a double that is "Access compliant". Stick a date format on it and it will display the proper date.
The_Doc_Man
01-19-2007, 10:05 PM
Well... almost.
IIRC time is correctly the time as stated. Float it, divide by 86400, and then ADD the date constant # 31 Dec 1969 # to the result. THAT will be a proper Access date adjusted for immediate use in date-field computations.
namliam
01-20-2007, 01:50 PM
Well... almost.
IIRC time is correctly the time as stated. Float it, divide by 86400, and then ADD the date constant # 31 Dec 1969 # to the result. THAT will be a proper Access date adjusted for immediate use in date-field computations.
LOL@Doc
/60/60/24 = /86400 except I think it makes it a little more clear what one is calculating....