Expand my Community achievements bar.

Help with Calculate Script

Avatar

Level 7

  The script below gives me The pattern: date{EEEE, MMMM DD, YYYY}

 

( DateWeekEnding.rawValue==null)

Calculate Event for TextField_A:

if

then

 

$.rawValue

= ""

else

Num2Date(Date2Num( DateWeekEnding.formattedValue, DateFmt(1)) +1, DateFmt(4))

endif

DateWeekEnding is a date fiels with Display pattern date.short{} and populate the date in the TextField_A

How I can get the pattern: date{EEEE, MMM DD, YY}  ?

Thanks

4 Replies

Avatar

Level 10

Hi,

I would try specifying the pattern in the Num2Date() and lose the display pattern in the Object > Field palette.

Num2Date(Date2Num( DateWeekEnding.formattedValue, DateFmt(1)) +1, "EEEE, MMM DD, YY")

Niall

Avatar

Level 7

Hi Niall, for 5 text fields on Calculate event I am using the script below(the only change are the number:+1,+2,+3,......):

 

if

( DateWeekEnding.rawValue==null)

then

Num2Date(Date2Num( DateWeekEnding.formattedValue, DateFmt(1)) +1, "EEE, MMM DD, YY")

The script above populate the date from DateWeekEnding fiels plus 1 day.

For the DateWeekEnding  Date field I am using the object display  pattern: date.short{} which give me MM/DD/YY.

Is it possible for this field to have the pattern:EEE, MMM DD, YY same as the other fields?

If I change the display pattern to date{EEE, MMM DD, YY} does not give the corect year for the text fields!

Thank you Niall

$.rawValue

= ""

else

Avatar

Level 10

Hi,

It should be possible. Try replacing date.short{}, with date{EEE, MMM DD, YY}.

Niall

Avatar

Level 7

Hi Niall,

I replaced(DateWeekEnding field) the display pattern from the date.short{}, to date{EEE, MMM DD, YY}.

but the dates I am getting for text fields are not correct!

I enter todays day for DateWeekEnding field and I am getting Mon, Jan 01, 00 for text field1, Tue, Jan 02, 00 for text field2

and so on..

what can be wrong?

Thank you