Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Calendar issues


Former Community Member
So I'm trying to create a serial number for form entries based on location, department, date and time. I've added scripting to convert the locations and departments to numbers and I want to add the date and time to the ends. I'm using the concatenation formula to do this. and everything seems to be easy enough except the date. When I type in the date, it is returned as I type it. But when I use the calendar drop down it is bound in a euro format "YYYY-MM-DD". I changed the binding format to MMDDYYYY, but it doesn't effect anything. I want the user to be able to use the calendar tool, but can anyone tell me how to override it's default format?


4 Replies


Level 7
You might want to look at the various 'format' options available. I prefer to set the display format and use the 'formattedValue' as this approach provides a known result no matter what is entered or LiveCycle Designer decides to default to. There is also the 'rawValue' and 'value'. 'rawValue' provides the entered data and 'value' is the assumed or default format value being used by the opened version of LiveCycle Designer.


Former Community Member
I've tried several different variations using Format, formattedValue, and DateFmt. If I type in the date it saves the data as what I type, but if I use the Calendar pop-up, it's still giving me a format that I don't want. This is frustrating.

At the very least I would like to figure out how to omit the dashes in the data format, YYYY-MM-DD.

TIA again.


Level 7
Using the following code in the "calculation" for a multiline text field:

// raw format

var sMsg = Concat("DateTimeField1.rawValue: ", DateTimeField1.rawValue, "\u000a")

// formatted value

sMsg = Concat(sMsg, "DateTimeField1.formattedValue: ", DateTimeField1.formattedValue, "\u000a")

// replace "-" with null

var sDate = Replace(DateTimeField1.formattedValue, "-", "")

sMsg = Concat(sMsg, "Using - Replace(DateTimeField1.formattedValue, '-', ''): ", sDate, "\u000a")

// Date2Num() and Num2Date reformat

sDate = Num2Date( Date2Num(DateTimeField1.formattedValue, "YYYY-MM-DD"), "YYYYMMDD")

sMsg = Concat(sMsg, "Using - Num2Date(Date2Num(DateTimeField1.formattedValue, 'YYYY-MM-DD'), 'YYYYMMDD'): ", sDate, "\u000a")


Produces the following result when a date is selected in the DateTimeField1:

DateTimeField1.rawValue: 2008-11-04

DateTimeField1.formattedValue: 2008-11-04

Using - Replace(DateTimeField1.formattedValue, '-', ''): 20081104

Using - Num2Date(Date2Num(DateTimeField1.formattedValue, 'YYYY-MM-DD'), 'YYYYMMDD'): 20081104


Former Community Member
That worked! Thank you very much. The only part I needed was:

var sDate = Replace(OccurenceDate.formattedValue, "-", "")

But it really helped to understand it when I looked at the whole code.

Thanks again.