top of page

61. Format a Date "900603" (yymmdd)

Description

How to format a date without spaces or separators.

Code

""
// Year
FORMAT( YEAR OF( DateVar ), "0009")
LAST( RESULT, 2 )

// Month
RESULT + FORMAT( MONTH OF( DateVar ), "09")

// Day
RESULT + FORMAT( DAY OF( DateVar ), "09")

Explanation

It might be helpful to review the HotDocs Technote entitled "How HotDocs Processes Date Variable Format Examples".

When a format contains no spaces, hyphens or slashes, HotDocs doesn't know how to process a number like "900603" so it reverts to the default date format which is the "mdy" settings contained in HotDocs Setup. If you used a format such as "90/14/03", it would come out as you want since "90" can't be a month or a day, "14" can't be a month - the year having been already processed, leaving "03" as the format for the day.

When you don't want spaces, hyphens, or slashes in the result, you'll have to use this text computation. The computation converts the date to numbers (YEAR OF, MONTH OF, DAY OF), then to text (FORMAT), and then appends them together (+). The output for the date "December 25, 2000" would be "001225". To place the elements in a different order, simply rearrange them in the script.

bottom of page