Insert a Date in Reverse Order

From HotDocs Wiki

Jump to: navigation, search

Sometimes you need to insert a date in reverse order. For example, you want May 10, 2000 to be inserted as 10/5/00. You may try to use the format 03/06/90. However, with a default date order of month-day-year, HotDocs still sees 03 as representing the month, 06 as representing the day, and 90 as representing the year.

One way to solve this problem is to create a Computation variable that contains DAY OF, MONTH OF, and YEAR OF expressions to format the date as desired.

Contents

Examples

Note: HotDocs can recognize dates entered in two orders: month-day-year (the default order in the United States) and day-month-year (the default outside the U.S.). You can select the default date entry order at HotDocs Options. See the HotDocs Help for details. The following computations use DAY OF, MONTH OF, and YEAR OF expressions to format a date in different formats.

In the following computations, Date Var is any Date variable.

Format a date as d/m/yy

FORMAT( DAY OF( Date Var ), "9" ) + "/" +
FORMAT( MONTH OF( Date Var ), "9" ) + "/" +
FORMAT( REMAINDER( YEAR OF( Date Var ), 100 ),"09" )

Format a date as dd/mm/yyyy

FORMAT( DAY OF( Date Var ), "09" ) + "/" +
FORMAT( MONTH OF( Date Var ), "09" ) + "/" +
FORMAT( YEAR OF( Date Var ), "9999" )

Note on HotDocs 2009 and Later

HotDocs 2009 introduced several new format examples for dates, which allow you unambiguously format any part of a date without resorting to computations as shown above. For example:

«Date Var:d/m/yy»
«Date Var:dd/mm/yyyy»

See the topic "Additional Date Formats" in the HotDocs help file for a complete listing of date formats you can use in HotDocs 2009 and later.