Date formatting

When you need date formatting done in JungleMail, you have many customization options. In this tutorial, you will learn how to do this yourself.


Date formatting is very simple in JungleMail. To format DateTime to string the FormatDate(date, format) function could be used.

FormatDate(date, format) – Converts date (Today; Now; DateTime columns) to text representation using specified patterns ("d", "t", "yy", "yyyy", "MMMM", "MM", "dd"). It also can be used to extract part of a date.

Examples

{FormatDate(Today; "yyyy")} Result: 2019 

{FormatDate(Created; "MMMM")} Result: March

{FormatDate(Today; "MMMM, yyyy")} Result: March, 2019

All you need to know is the right date patterns. A standard date and time format string uses a single format specifier to define the text representation of a date and time value. Any date and time format string that contains more than one character, including white space, is interpreted as a custom date and time format string. In other words: a date and time format string defines the text representation of a DateTime or DateTimeOffset value that results from a formatting operation.

Standard date and time format strings

  Pattern MM/dd/yyyy Result 03/22/2016
  dddd, dd MMMM yyyy Tuesday, 03 March 2016
  dddd, dd MMMM yyyy HH:mm  Tuesday, 03 March 2016 06:30
  dddd, dd MMMM yyyy hh:mm tt  Tuesday, 03 March 2016 06:30 AM
  dddd, dd MMMM yyyy H:mm  Tuesday, 03 March 2016 6:30
  dddd, dd MMMM yyyy h:mm tt  Tuesday, 03 March 2016 6:30 AM
  dddd, dd MMMM yyyy HH:mm:ss Tuesday, 03 March 2016 06:30:07
  MM/dd/yyyy HH:mm 03/22/2016 06:30
  MM/dd/yyyy hh:mm tt 03/22/2016 06:30 AM
  MM/dd/yyyy H:mm 03/22/2016 6:30
  MM/dd/yyyy h:mm tt 03/22/2016  6:30 AM
  MM/dd/yyyy h:mm tt 03/22/2016  6:30 AM
  MM/dd/yyyy h:mm tt 03/22/2016  6:30 AM
  MM/dd/yyyy HH:mm:ss 03/22/2016 06:30:07
  MMMM dd March 22
  MMMM dd March 22
  yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK 2016-03-22T06:30:07.7199222-04:00
  yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK 2016-03-22T06:30:07.7199222-04:00
  ddd, dd MMM yyyy HH':'mm':'ss 'GMT' Tue, 22 Mar 2016 06:30:07 GMT
  ddd, dd MMM yyyy HH':'mm':'ss 'GMT' Tue, 22 Mar 2016 06:30:07 GMT
  yyyy'-'MM'-'dd'T'HH':'mm':'ss 2016-03-22T06:30:07
  HH:mm 06:30
  hh:mm tt 06:30 AM
  H:mm 6:30
  h:mm tt 6:30 AM
  HH:mm:ss 06:30:07
  yyyy'-'MM'-'dd HH':'mm':'ss'Z' 2016-03-22 06:30:07Z
  dddd, dd MMMM yyyy HH:mm:ss Tuesday, 22March 2016 06:30:07
  yyyy MMMM 2016 March

   

How to build a custom date and format string

You can also build your own date and time string. Here are all the separate characters you can use, along with their qualities. 

d Represents the day of the month as a number from 1 through 31. A single-digit day is formatted without a leading zero
dd Represents the day of the month as a number from 01 through 31. A single-digit day is formatted with a leading zero
ddd Represents the abbreviated name of the day of the week (Mon, Tues, Wed etc)
dddd Represents the full name of the day of the week (Monday, Tuesday etc)
h 12-hour clock hour (e.g. 7)
hh 12-hour clock, with a leading 0 (e.g. 07)
H 24-hour clock hour (e.g. 19)
HH 24-hour clock hour, with a leading 0 (e.g. 19)
m Minutes
mm Minutes with a leading zero
M Month number
MM Month number with leading zero
MMM Abbreviated Month Name (e.g. Dec)
MMMM  Full month name (e.g. December)
s Seconds
ss Seconds with leading zero
t Abbreviated AM / PM (e.g. A or P)
tt AM / PM (e.g. AM or PM
y Year, no leading zero (e.g. 2001 would be 1)
yy Year, leading zero (e.g. 2001 would be 01)
yyy Year, (e.g. 2001 would be 2001)
yyyy Year, (e.g. 2001 would be 2001)
K Represents the time zone information of a date and time value (e.g. +05:00)
z With DateTime values, represents the signed offset of the local operating system's time zone from Coordinated Universal Time (UTC), measured in hours. (e.g. +6)
zz Same as above,  but with leading zero (e.g. +06)
zzz With DateTime values, represents the signed offset of the local operating system's time zone from UTC, measured in hours and minutes. (e.g. +06:00)
f Represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value.
ff Represents the two most significant digits of the seconds fraction; that is, it represents the hundredths of a second in a date and time value.
fff Represents the three most significant digits of the seconds fraction; that is, it represents the milliseconds in a date and time value.
ffff Represents the four most significant digits of the seconds fraction; that is, it represents the ten thousandths of a second in a date and time value. 
fffff Represents the five most significant digits of the seconds fraction; that is, it represents the hundred thousandths of a second in a date and time value. 
ffffff Represents the six most significant digits of the seconds fraction; that is, it represents the millionths of a second in a date and time value. 
fffffff Represents the seven most significant digits of the seconds fraction; that is, it represents the ten millionths of a second in a date and time value. 
F Represents the most significant digit of the seconds fraction; that is, it represents the tenths of a second in a date and time value. Nothing is displayed if the digit is zero.
: Represents the time separator defined in the current DateTimeFormatInfo..::.TimeSeparator property. This separator is used to differentiate hours, minutes, and seconds.
/ Represents the date separator defined in the current DateTimeFormatInfo..::.DateSeparator property. This separator is used to differentiate years, months, and days.
" Represents a quoted string (quotation mark). Displays the literal value of any string between two quotation marks ("). Your application should precede each quotation mark with an escape character (\).
' Represents a quoted string (apostrophe). Displays the literal value of any string between two  apostrophe  (') characters.
%c Represents the result associated with a c custom format specifier, when the custom date and time format string consists solely of that custom format specifier. That is, to use the d, f, F, h, m, s, t, y, z, H, or M custom format specifier by itself, the application should specify %d, %f, %F, %h, %m, %s, %t, %y, %z, %H, or %M. For more information about using a single format specifier, see Using Single Custom Format Specifiers.
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us