Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Keep zero in date format

Avatar

Level 3

I've been searching and searching for this answer.

I have a Date field in a form on LiveCycle.

This is not a field that anyone enters the date, but it simply puts the current date in.

I would like it to keep the 0's in the format.  So if the date is 01/08/2014, I want it to read as this, not 1/8/14.

I'm using this value in an invoice field where I am concating two fields together and I want the 0's to stay.

Any help would be great.  Thanks!

8 Replies

Avatar

Level 10

Hi,

you need to define a display pattern for the date field, to get the desired formatting.

Add this display pattern to your field.

date{MM/DD/YYYY}

Avatar

Level 3

I tried this earlier and again just now and it refuses to put the zeros in.

When I test the form it still comes up, 1/8/14.

Avatar

Level 10

How do you populate the date?

Avatar

Level 3

It's a Calculated - Read Only field and I use FormCalc

 

$.rawValue

= num2date(date(),

DateFmt(1))

Avatar

Level 10

Ok, that's the reason why the date is displayed in that way.

DateFmt(1) returns the short style M/D/YY.

Use DateFmt(2, $.locale) instead.

Avatar

Level 3

That makes sense, is there a table somewhere that explains all the Date Formats?

This is now saying Jan 8, 2014.