You are viewing limited content. For full access, please sign in.

Question

Question

YY Format Does Not Work in Workflow Testing

asked on June 4, 2020 Show version history

When formatting a date token and using YYYY for the year, the result output does not accept it. If you use yyyy instead it does work. According to the help file you should be able to use either one.

Workflow Designer Version 10.4.2.246

1 0

Replies

replied on June 4, 2020

In the image of the help file, you are in the "Specifier" of the "Standard Date and Time Format Strings" section and it is designating a single Y or y and it states that it returns "the year and month according to the Workflow Server computer's regional settings".

You want to look in the "Custom Date and Time Format Strings" section where it designates lower case y, yy, yyy, yyyy, etc. and states that it returns the year to the number of digits equal to the number of years. If the year has fewer digits than specified, it will be padded with leading zeroes.

 

In my testing, the only way the single lowercase y returns the year only (instead of the year and month is if it is not the only character in the Formatting string.

 

Date = 06/04/2020

Format = y or Y     Result = June 2020

Format = M/d/y     Result = 6/4/20

2 0
replied on June 4, 2020

We use .Net for formatting and that seems to be their behavior. If you try any of the sample scripts in their documentation, they give you the same results. I can't find an indication of whether this is a bug or expected behavior. Use lower case 'y' for specifying the number of digits in the year.

Side comment: formatting 12/20/30 to MM/dd/yyyy will likely result in 12/20/1930 as Windows machines default the range for interpreting 2-digit years to 1930-2029. The range can be changed in Control Panel. I would still recommend against using 2-digit years.

2 0
You are not allowed to follow up in this post.

Sign in to reply to this post.