Different results using str2date

I get different dates returned depending on what date format I use in str2date.

I’m using a str2date in Reformat, and it’s being loaded into a date metadata field.
The metadata is being formatted as yyyy-MM-dd HH:mm:ss, and my default local timezone.

If I use str2date(‘01.01.1753’,‘MM.dd.yyyy’)
It returns the date I expect: 1753-01-01 00:00:00

If I use str2date(‘1753-01-01’,‘YYYY-MM-dd’)
It returns a different date, and I can’t figure out why: 1752-12-31 00:00:00

I can use the first str2date, and it works, but it concerns me that it would be different in the first place.
It took a lot of troubleshooting, and I just stumbled on to the solution.
Does anyone know why it works this way?

Thanks

Hi hewills,

The reason the output is a different date has to do with the capital Y. In Java, the capital Y stands for week year, which is different for y (Year). To resolve the issue just minimize the Y on the second str2date and it will output the correct date value.