2022.2

Table Of Contents
Note: JavaScriptcountsmonthsfrom0to11.Januaryis0.Decemberis11.
AnotherwaytoputastringinaDateistousetheDate.parsefunction;seehttps://developer-
.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse.
Thedatevariablecanbeusedasthevalueinthedate,dateTimeortimefunctionsoftheformatter.
var myDate = formatter.date(date, "MM/dd/yyyy");
Thecustompatternthatthescriptprovides,outputsthemonthanddayintwodigitseachandtheyear
infourdigits:05/21/2016.Formoreexamplesofformattingpatterns,see"Dateandtimepatterns"
below.
Date and time patterns
Datesandtimesinatemplateoriginatingfromadatefieldinarecordsetcanbedisplayedusingacus-
tompattern.IntheScriptEditor,thepatterncanbepassedtoadate,dateTimeorTimefunctionofthe
formatter;see"formatter"onpage721.
Thecustompatternmayconsistofpatternletters(seebelow),forexample:"MM/dd/yyyy".Thecom-
ponentscanbeseparatedwithaspaceorasymbol,e.g..,/,-.Textmustbeputinquotes.
Therepetitionofpatternlettersdeterminestheexactpresentation.Forexample,ifthenumberofpat-
ternlettersforamonthislessthan3(MorMM),themonthisdisplayedasanumber.Ifthenumberof
patternlettersis3(MMM),itwillbedisplayedastext;ifavailable,ashortorabbreviatedformofthe
month'snamewillbeused.Ifthenumberofpatternlettersis4ormore(MMMM),themonth'sfullname
isdisplayed.
Note: Thepatternlettersandpatternsonthispageareonlysuitablefordisplayingdatesand
timesintemplates.
Pattern characters
Letter Component Presentation Examples
G Eradesignator Text AD
y Year Year 1996;96
Y Weekyear Year 2009;09
M Monthinyear Month July;Jul;07
Page 724