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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need date to store month and day only (access 2003)

Status
Not open for further replies.

dawnd3

Instructor
Jul 1, 2001
1,153
US
Is there a way to format a date field so that it holds the month and day only, not year. I have it SHOWING the month and day only but it still holds a year which I don't want it to do.

Thanks for any help,

Dawn

 
No, I do not think so, a date field holds a number which is interpreted as a date. You will need another type of field, or a field for month and day.
 


The definition of a date is year, month and day.

You can format any date to display only the month and day like this in a query...
[tt]
Format([MyDate], "mmm-dd")
Format([MyDate], "dd/mm")
Format([MyDate], "mm/dd")
Format([MyDate], "m-d")
[/tt]
ad infinitum minus one!

Skip,

[glasses] [red]Be Advised![/red] A chicken, who would drag a wagon across the road for 2 cents, is…
POULTRY in motion to PULLET for a PALTRY amount! [tongue]
 
The Dates are a certain number of days since a beginning set point. They are all integers. They are only displayed as month/day/year or however you want them displayed. Internally they are all stored as integers. Most databases store the dates simalarly.

If you do not like my post feel free to point out your opinion or my errors.
 
Well ... no ... they are doubles, not integers.

The whole number part of the double (left of the decimal place) is the number of days since Dec 30, 1899 and the fractional part is the time expressed as a fraction of a day.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Thank you all! I didn't hear what I wanted to hear but it makes sense to me now. I appreciate all your replies. I do already have it in mm/dd format but if I try to pull a date range it looks at the year (that is entered automatically) and doesn't give me accurate results. I have had to pull the month out into another field and query on month. I just can't do a date range I don't think.

Thanks again,

Dawn

 
You can ignore whatever part of the DateTime field you want by using the functions Year, Month, MonthName, Day, etc. For example
Code:
Select *

From myTable

Where Month([SomeDateField]) = 1
Selects all January records regardless of year or day.

[small]No! No! You're not thinking ... you're only being logical.
- Neils Bohr[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top