Date Format/Input Mask

D

DD

I need to create a field in a table to store a date like
January 2004, February 2004, March 2004 (or 1/2004,
2/2004, etc). Each month we will enter in some stats for
the month and ultimately my goal will be to do some
reporting based upon month so I will need to be able to
sort on this field in some cases ascending and others
descending. So, I will need to be sure however I format
this field I need to be able to sort properly and not
1/2004, 10/2004. So, I need some suggestions on how to
format the field and with some type of mask. Thanks in
advance great ones! Happy and safe 4th.
 
D

Douglas J. Steele

Date fields can only be used to store complete dates. That's because they
store dates as 8 byte floating point numbers, where the integer part
represents the date as the number of days relative to 30 Dec, 1899 and the
decimal part represents the time as a fraction of a day. That means you're
either going to have to assign a default day (1st of the month, end of the
month, whatever) if you want to use a date field. If you do that, they'll
sort properly. If, on the other hand, you store the date as a text field,
your only choice to get it to sort properly would be to store it in a format
that will sort correctly, such as yyyymm.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top