Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

yyyy format not working

Status
Not open for further replies.

CHTHOMAS

Programmer
Jun 16, 1999
106
AE
How can i store year alone in a table? (4 digits. Eg.2001.) What Date format and input mask to use? I don't want to use either number or text format. Any help will be appreciated.

Regards

Charley
 

Access stores dates as double precision numbers (8 bytes). The integer part is a numeric representation of only the date. It is an offset from a fixed point in time (12/30/1899), and all dates are stored as the number of days before or since this date. Time is stored in the decimal part of the field.

Therefore, you will always have months and days represented. You can extract only the year with the Year, Datepart and Format functions.

Year(Date_col) returns an integer
Datepart("yyyy", date_col) returns an integer
format(date_col, "yyyy") returns a string

However, if all you want to store is the year, I recommend using an integer or text field. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top