Skip to main content

Formatting Dates in Merge Fields

Learn how to customize the format of any date field in your document templates using the date() merge tag.

Updated over 3 weeks ago

When you generate documents in Baseline, dates show up in a default format like "September 14, 2023". But what if your documents need a short date like "09/14/2023", or just the day with an ordinal like "14th"? That's where the date() merge tag comes in.

You can take any date field stored on a loan and control exactly how it appears in your generated documents.


How It Works

The date() tag takes two inputs:

  1. The field name (the date field on the loan, like "Origination" or "Maturity")

  2. A format string (a pattern that tells the system how to display the date)

The syntax looks like this:

«date("Field_Name","format_string")»

So if your loan has an origination date of September 14, 2023, here's what different format strings would produce:

Merge Tag

Output

«date("Origination","MM/dd/yyyy")»

09/14/2023

«date("Origination","MMMM do, yyyy")»

September 14th, 2023

«date("Origination","do")»

14th


Date Fields You Can Format

Any date field in the system works inside a date() tag. Here are some of the ones you'll use most often:

Date Field

Field Name in Tag

Example Usage

Origination Date

Origination

«date("Origination","MM/dd/yyyy")»

Maturity Date

Maturity

«date("Maturity","MMMM d, yyyy")»

First Payment Date

First_Payment

«date("First_Payment","MM/dd/yyyy")»

Paid Through Date

Paid_Through

«date("Paid_Through","MMM d, yyyy")»

Next Payment Due

Next_Payment_Due

«date("Next_Payment_Due","MMMM do")»

Purchase Date

Address_Purchase_Date

«date("Address_Purchase_Date","yyyy-MM-dd")»

Current Date

Date

«date("MM/dd/yyyy")»

💡 Tip: When formatting the current date (today's date), you only need one input: the format string. Example: «date("MMMM do, yyyy")». When formatting a date from a loan field, you need both the field name and the format string.


Format Tokens Reference

The format string is built from tokens: letter patterns that get swapped out for parts of the date. These are case-sensitive, so be careful. MM gives you the month, but mm gives you minutes.

Day

Token

What It Does

Example Output

d

Day of the month

1, 2, ..., 31

dd

Day of the month, zero-padded

01, 02, ..., 31

do

Day with ordinal suffix

1st, 2nd, 3rd, ..., 31st

Month

Token

What It Does

Example Output

M

Month number

1, 2, ..., 12

MM

Month number, zero-padded

01, 02, ..., 12

MMM

Short month name

Jan, Feb, ..., Dec

MMMM

Full month name

January, February, ..., December

Year

Token

What It Does

Example Output

yy

Two-digit year

23, 24, 25

yyyy

Four-digit year

2023, 2024, 2025

Day of the Week

Token

What It Does

Example Output

EEE

Short day name

Mon, Tue, Wed, ...

EEEE

Full day name

Monday, Tuesday, ...


Common Format Examples

Here are some ready-to-use format strings for typical lending documents. All examples below assume the date is September 14, 2023.

What You Want

Format String

Result

US short date

MM/dd/yyyy

09/14/2023

Short date, no leading zeros

M/d/yyyy

9/14/2023

Long formal date

MMMM d, yyyy

September 14, 2023

Long date with ordinal

MMMM do, yyyy

September 14th, 2023

Abbreviated month

MMM d, yyyy

Sep 14, 2023

ISO format

yyyy-MM-dd

2023-09-14

With full weekday name

EEEE, MMMM do, yyyy

Thursday, September 14th, 2023

Month and year only

MMMM yyyy

September 2023

Just the day with ordinal

do

14th

Just the month name

MMMM

September

Just the year

yyyy

2023


Adding Plain Text Inside a Format String

Sometimes you need words mixed in with the date, like "the 14th day of September, 2023". To stop the system from treating those words as tokens, wrap them in single quotes.

For example:

«date("Origination","'the' do 'day of' MMMM, yyyy")»

This would output: the 14th day of September, 2023

The parts in single quotes ('the' and 'day of') show up exactly as written, while the tokens (do, MMMM, yyyy) get replaced with actual values from the date.


Things to Keep in Mind

  • Case matters. MM = month (01-12). mm = minutes (00-59). Always use uppercase M for months and lowercase y for years.

  • The field needs to have a date in it. If the date field on the loan is empty, the tag won't produce any output. Make sure the field is filled in before generating the document.

  • Custom date fields work too. If you've created a custom date field like "Extension_Date", you can format it the same way: «date("Extension_Date","MM/dd/yyyy")»

📚 For the full list of merge fields available in the system, see List of Merge Fields.

Did this answer your question?