Expand my Community achievements bar.

SOLVED

Date-Time Display pattern remains the same

Avatar

Level 3

If I set the Object Value Type of a Date/Time field to "Calculated-Read Only" am I stuck with YYYY-MM-DD HH:MM:SS format?

Why do my changes in Pattern Data/Display have no effect?

I would like to have the calculated date/time displayed automatically (this is working OK) and I would like the date format to be compatible with company policy which is MM-DD-YYYY.

Any thoughts?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

If you amend your FormCalc to this, you should be okay:

$.rawValue = num2date(date(), "MM-DD-YYYY")

Hope that helps,

Niall

View solution in original post

6 Replies

Avatar

Correct answer by
Level 10

Hi,

If you amend your FormCalc to this, you should be okay:

$.rawValue = num2date(date(), "MM-DD-YYYY")

Hope that helps,

Niall

Avatar

Level 3

I am new to this. So, I don't know how or why it works, but it works! Thanks

p.s. btw, if I want to add the time, do I do it on a separate line or can I append to it.

Avatar

Level 10

Sorry for the delay!

You can achieve this in one line, but you need to deal with the date using num2date and the time with num2time (see Help) and then using the Concat FormCalc method to join the two answers:

$.rawValue = Concat(num2date(Date(), "MM-DD-YYYY"), " ", num2time(Time(), "HH:MM:SS"))

Hope that helps,

Niall

Avatar

Level 3

No problem...Thanks for all your help!

Avatar

Former Community Member

Im a complete noob at this program (and scripting in general)

How do I amend the FormCalc? I cant find anywhere where I can do this.

Thanks.

Avatar

Level 3

Under the menu bar (in the center) you will see a downward pointing arrow, if the scripting window is not already open, click on arrow to open the scripting window. In the Language dropdown menu, choose FormCalc. See screen cap below (click to enlarge).  Hope this helps.

FormCalc.jpg