Date Algorithm

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the Month, Day and Year in 3 separate fields and now need to
concatenate the 3 fields into one field (Date). What is the algorithm to get
the number Microsoft uses to store a date?
 
JimN said:
I have the Month, Day and Year in 3 separate fields and now need to
concatenate the 3 fields into one field (Date). What is the algorithm to get
the number Microsoft uses to store a date?

Just use ...

DateSerial(YearField, MonthField, DayField)

Internally Access stores dates a Double Number types. The integer portion is
the count of days since 12-30-1899 and the fractional portion is the time as a
percentage of hours (noon = .5)
 
Do you mean the one that they use in Datevale() ?

DateValue Function... Syntax ... DateValue(date)

The required date argument... is normally a string expression ( ... a
string literal, constant, variable, or Variant.) representing a date from
January 1, 100 through December 31, 9999. :
 
I have the Month, Day and Year in 3 separate fields and now need to
concatenate the 3 fields into one field (Date). What is the algorithm to get
the number Microsoft uses to store a date?

DateSerial([Year], [Month], [Day])

Note that your three fieldnames are reserved words and BAD choices for
fieldnames; I'd suggest either changing them or always enclosing them
in square brackets.

John W. Vinson[MVP]
 
And ...
If you get a Mismatch error on Rick's solution change it to:

DateSerial(Cint(YearField), Cint(MonthField), Cint(DayField))

Regards/JK
 
Back
Top