DateDiff problem

  • Thread starter Thread starter JoeP
  • Start date Start date
J

JoeP

I have a field that was imported as part of a text file. The field comes in
as a string of numbers 20090107 which I have converted to a date using
DateSerial function and it now appears in the calculated field StartConvert
as 2009-01-07.

I want to calculate how many days from the date in StartConvert to today's
date which right now is Jan 28 2010. I use the following calculation...

TestDate: DateDiff("d",[StartConvert],Date()). I receive the answer 20 when
in fact the answer should be 385.

What am I doing wrong?
Thanks for any help.

JoeP
 
Since you only want days, try this:

TestDate: Date() - [StartConvert]

This assumes that StartConvert is a date field.

A very strange possibility would be that the date in you PC is really wrong.
 
i was thinking the same thing that possibly the date on the PC is
wrong.

you could also try putting CDate([StartConvert]) to make sure it is
being processed as a correct date format in the datediff function.
 
I have a field that was imported as part of a text file. The field comes in
as a string of numbers 20090107 which I have converted to a date using
DateSerial function and it now appears in the calculated field StartConvert
as 2009-01-07.

What's your actual conversion expression? I.e. is StartConvert a Date/Time
field (the result of the DateSerial function directly), or a Text field
(wrapping DateSerial in a Format)?
 
Back
Top