Link to home
Start Free TrialLog in
Avatar of bradbritton
bradbritton

asked on

How to calculate date in Access 2003

I have a query where I need to calculate the number of days from January 1st 1960, based on the data pulled.

For Example:

December 31 1959 = -1
Janurary 2nd 1960 = 1

I have tried the DateDiff ('d', 01/01/1960, [tablename].[date]) , but this doesnt seem to work properly...

Thanks,

Brad
Avatar of dougvarga
dougvarga
Flag of United States of America image

Jet SQL will handle date math of this type natively, so try something like:

select [mydatefield]-#1/1/1960#  as NumberofDays from mytable;
Avatar of bradbritton
bradbritton

ASKER

I am using Access to build my queries, but I am actually connected to an Oracle DB. Is this still possible?
ASKER CERTIFIED SOLUTION
Avatar of dougvarga
dougvarga
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
I am using linked tables.
Avatar of Sharath S
Did you try the first post #26440626 ?
Curious  - As indicated, my 1st post should have been the correct Syntax for your scenario with Linked Tables.

Did this work for you?