FORMATING DATES IN LEGALSUITE
INTRODUCTION
Dates in LegalSuite are stored as a number (e.g. 75123) in the underlying SQL database.
The number represents the number of days that have passed since 1 January 1800.
Storing a date as a number makes it easy (from a programming perspective) to perform arithmetic calculations with dates. E.g. to calculate the number of days between two dates you simple subtract the second date from the first date (date2 – date1).
The disadvantage is that a number like 75123 has no bearing on the actual date from a user’s point of view, i.e. it is pretty meaningless.
Therefore, it is important, when using date fields, to change the number to the familiar dd/mm/yy format.
MERGE FIELDS
To do this when using the Merge Fields in LegalSuite, one simply chooses the Short Date (i.e. 18/06/2008) or Long Date (i.e. 18 June 2008) options from the Format section.

This will then display the date in the appropriate format and in the language of the Document Language of the Matter.
DOCUMENT FIELDS
LegalSuite has the ability to insert data directly into a document without first creating a Merge Field. This can be very useful to extract data directly out of the database and insert it straight into the document.
For example, if you wanted the File Reference of the Matter in the Document, you would use this syntax:
|
Field |
Assemble Document |
Result |
|
[[(MAT:FileRef)]] |
à |
ABC1/0001 |
The program takes whatever is found between the round brackets and attempts to insert it into the document at this position. This is a very simple, yet powerful feature of the program.
Care, however, need to be taken when using date field. If, for example, you wanted to insert the Important Date for a Matter somewhere in a document

and you just did this
|
Field |
Assemble Document |
Result |
|
[[(MAT:ImportantDate)]] |
à |
75123 |
Your output would be a number, i.e. the date in its raw form
To solve this problem, one has to use a bit of programming to specify exactly how you want the number to be displayed (i.e. formatted)
This done by using the FORMAT command which is used in this manner:
Format(variable, date picture)
For example:
|
Field |
Assemble Document |
Result |
|
[[(Format(MAT:ImportantDate,@D17))]] |
à |
12/05/2006 |
Below is a table of all the date pictures you can use with the FORMAT command
|
Picture |
Format |
Result |
|
@D1 |
mm/dd/yy |
10/31/07 |
|
@D2 |
mm/dd/yyyy |
10/31/2007 |
|
@D3 |
mmm dd, yyyy |
OCT 31,2007 |
|
@D4 |
mmmmmmmmm dd, yyyy |
October 31, 2007 |
|
@D5 |
dd/mm/yy |
31/10/07 |
|
@D6 |
dd/mm/yyyy |
31/10/2007 |
|
@D7 |
dd mmm yy |
31 OCT 07 |
|
@D8 |
dd mmm yyyy |
31 OCT 2007 |
|
@D9 |
yy/mm/dd |
07/10/31 |
|
@D10 |
yyyy/mm/dd |
2007/10/31 |
|
@D11 |
Yymmdd |
071031 |
|
@D12 |
Yyyymmdd |
20071031 |
|
@D13 |
mm/yy |
10/07 |
|
@D14 |
mm/yyyy |
10/2007 |
|
@D15 |
yy/mm |
07/10 |
|
@D16 |
yyyy/mm |
2007/10 |
|
@D17 |
|
Windows setting for Short Date |
|
@D18 |
|
Windows setting for Long Date |
Some users also need to insert the Day of the Week and the date in a document. This is achieved by using another programming function called
GetDayOfWeek(date)
It will work out the Day of the Week the date falls on and insert it into the document in the appropriate language.
|
Field |
Assemble Document |
Result |
|
[[(GetDayOfWeek(MAT:ImportantDate))]] |
à |
Monday |
If you want to insert the complete formal date including the Day of the Week into a document (which is often needed in some court documents) you can do it this way
|
Field |
Assemble Document |
Result |
|
[[(GetDayOfWeek(MAT:ImportantDate))]], [[(Format(MAT:ImportantDate,@D18))]] |
à |
Monday, 12th May 2006 |
Notice that there are two document fields
[[(GetDayOfWeek(MAT:ImportantDate))]]
and
[[(Format(MAT:ImportantDate,@D18))]]
and that they are separated by a comma.
CONCLUSION
The Document Fields give you a lot of flexibility to insert the data into a document exactly as you would like it to appear and by combining various fields and formatting techniques, one can develop quite complex field structures that look impressive once assembled in a document.