SOLVED

Re: Token dates in emails are an unacceptable format

Go to solution
Joe_Barrett
Level 2

Token dates in emails are an unacceptable format

I imported a spread sheet that has a date of birth field with a field type of  'date' . The date of birth was formatted in a csv as  05/18/2084 and uploaded to that person's data. The database > info > date of birth field in the person data shows, May 18, 2084. The email I've sent out has a token to get the person's dob, {{lead.Date of Birth:default=edit me}}. The email in their inbox displays that as, 2084-05-18. Where is the setting to fix how tokens render the date in SMS or email? Or is there another setting somewhere to change so the dob is in an acceptable format?

2 ACCEPTED SOLUTIONS

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Token dates in emails are an unacceptable format

Well, ISO yyyy-MM-dd is a pretty standard format (the only internationally unambiguous format).

 

If you want friendly localized format, use Velocity $date.format.

 

Ensure you’re working with real Java dates using the timezone guidance at

Velocitips: Switch email content based on day/time

 

 

View solution in original post

SanfordWhiteman
Level 10 - Community Moderator

Re: Token dates in emails are an unacceptable format

Dates aren’t stored as strings.

 

They’re stored as SQL Dates, which take only 3 bytes (it would take a wasteful 10 bytes to store the literal 10 characters “2024-01-01”).

 

The standard output format is yyyy-MM-dd, but they’re not actually stored that way. The reason you can use a (small) range of recognized import formats is the database knows how to turn them all into Dates on the way in.

View solution in original post

5 REPLIES 5
SanfordWhiteman
Level 10 - Community Moderator

Re: Token dates in emails are an unacceptable format

Well, ISO yyyy-MM-dd is a pretty standard format (the only internationally unambiguous format).

 

If you want friendly localized format, use Velocity $date.format.

 

Ensure you’re working with real Java dates using the timezone guidance at

Velocitips: Switch email content based on day/time

 

 

Joe_Barrett
Level 2

Re: Token dates in emails are an unacceptable format

Why is it doing that? Changing the format from what is uploaded and is in the database?

SanfordWhiteman
Level 10 - Community Moderator

Re: Token dates in emails are an unacceptable format

Dates aren’t stored as strings.

 

They’re stored as SQL Dates, which take only 3 bytes (it would take a wasteful 10 bytes to store the literal 10 characters “2024-01-01”).

 

The standard output format is yyyy-MM-dd, but they’re not actually stored that way. The reason you can use a (small) range of recognized import formats is the database knows how to turn them all into Dates on the way in.

Joe_Barrett
Level 2

Re: Token dates in emails are an unacceptable format

That link goes nowhere/is broken. Is there a specific-to-the-stated-problem guide or tutorial for "velocity scripts" fixing this date from token issue?  

SanfordWhiteman
Level 10 - Community Moderator

Re: Token dates in emails are an unacceptable format


That link goes nowhere/is broken.

Fixed the link, had a trailing period included by accident.