OOFILE | Downloads | Purchasing | Press | Services | Company Information | Soapbox | References | F.A.Q. | HOME

Date format masks

Format masks for a date field allow you to specify in what format the date appears for example: 25th August 1998 or 25-08-98 etc. This means that you can change between digits and words, specify whether you want 'th' or 'st's following the day number, or use 3 letters only for the month/day or use 2 or 4 digits for the year etc.

We set the date format by using the function formatMask() and passing in the string with the formatting (much like passing a format string to printf). The valid formats to pass in are listed below. The spaces between the Format masks can be anything you like except brackets (used internally by OOFILE). So you can have each mask seperated, for example, by ":" or "-", by spaces or by any other character you'd like to use. Thi is useful as you can match it up to whatever delimiters you are used to for the purposes of parsing through the data later.

For example, for the table Invoicing, I could format the field DateDue this way:

	Invoicing.DateDue.formatMask("ddth Month YYYY");  

An example of the date it would return would be: 25th August 1998

Another example might be:

	Invoicing.DateDue.formatMask("dd:MM:YY");  

This would give: 25:08:98

Below is a list of the date formats usable and what they will give for you when used.

DDDD   Dddd   dddd
Will write the day number in 4 columns eg "  25" or "    1". Capitalisation does not matter for this one, but is included so we don't have to worry about which letters are capitalised.
DDD  Ddd  ddd
Will write the day number in 3 columns eg " 25" or "  1". Capitalisation does not matter for this one, but is included so we don't have to worry about which letters are capitalised.
DDTH
This will write the day number followed by "ST", "ND", "RD" or "TH". eg "25TH" or "1ST".
ddth
This will write the day number followed by "st", "nd", "rd" or "th". eg "25th" or "1st"
DD
This will write the day number in 2 columns eg "25" or " 1".
DAYNAME
This will write the name of the day in all-caps eg "TUESDAY" or "FRIDAY"
Dayname
This will write the name of the day with the first letter capitalised eg "Tuesday" or "Friday"
dayname
This will write the name of the day in all lower letters eg "tuesday" or "friday"
DAY
This will write the first 3 letters of the day's name in all-caps eg "TUE" or "FRI"
Day
This will write the  first 3 letters of the day's name with the first letter capitalised eg "Tue" or "Fri"
day
This will write the  first 3 letters of the day's name in all lower letters eg "tue" or "fri"
D
This will write the first letter of the day's name in a capital letter eg "T" or "F"
MMMM  Mmmm  mmmm
These will write the month number in 4 columns, case of these are ignored. eg "    8" or "  12"
MMM  Mmm  mmm
These will write the month number in 3 columns, case of these are ignored. eg "   8" or " 12"
MM
This will write the month number in the more standard 2 column format eg "08" or "12"
MONTH
This will write the full name of the month in all-caps eg "AUGUST" or "DECEMBER"
Month
This will write the full name of the month with the first letter capitalised eg "August" or "December"
month
This will write the full name of the month in all lower letters eg "august" or "december"
MON
This will write the first 3 letters of the month's name in all-caps eg "AUG" or "DEC"
Mon
This will write the  first 3 letters of the month's name with the first letter capitalised eg "Aug" or "Dec"
mon
This will write the  first 3 letters of the month's name in all lower letters eg "aug" or "dec"
M
This will write the first letter of the month's name in a capital letter eg "A" or "D"
YYYY
This will write the full 4-digit year eg "1998" or "2001"
YY
This will write the last two digits fo the year eg "98" or "01"
YEAR
This will write the year in words?

An example of the use of date format masks is provided in ooftst33

 

Feature index

(c) Copyright A.D. Software 1994-2000 (All Rights Reserved).
Last Updated: 9th September 2001