Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

I'm trying to add 10/60 days to a user defined date but get Jan 10, 1900

Avatar

Level 1

I'm creating a form that asks the user to input a date in a date time field (usually it will be the present date or close to it). The users will use the drop-down calendar date picker to choose the date.

This is what I have for the 10 day date field but the output is always January 10 1900. I assume it has to do with epoch but have no clue how to fix this

if

(HasValue(DateTimeField1))then

Num2Date((Date2Num(DateTimeField1)

+10),"EEEE,MMMM D,YYYY")

else

null

I would appriciate any help I could get.

Thanks!

0 Replies

Avatar

Level 6

Here's an option:

if (Date1.rawValue ne null) then
    Num2Date(Date2Num(Date1.formattedValue, "MM/DD/YYYY") + 10, "MM/DD/YYYY")
else
    null
endif

Avatar

Level 1

I tried this and still get a return value of Wednesday, January 10, 1900 reguardless of date entered.

Any thoughts...

Avatar

Level 6

Sample attached.  See Date Assigned and subsequent review dates.  Change the Assigned date and the dates change

Avatar

Level 1

I got it mostly working by messing with the date format in the script and display pattern plus data pattern in the object control panel.

It seems to be very touchy and different date formats don't seem to play well with each other.  I am not getting EEEE, MMMM D,YYYY working.

I am getting MM/DD/YYY to work which is good but I would rather display the dates with the day if possible. If I use the EEEE,MMMM D,YYYY I still get the January 10 1900.

Thanks for all the help so far!!!

Avatar

Level 1

After messing around some more I was able to get the output dates to display EEEE,MMMM DD,YYYY. But only if the input date is formatted MM/DD/YYYY.

This is liveable but would be great to have consistent formats.