Convert String to Date and back

0
Hi, i’m trying to convert a string to date and back. It probably works fine but doesn’t work with my input.   Error: An error occurred while evaluating value of MyFirstModule.Home_Web.text1: Unparseable date: "Tue, 30 Mar 2021 10:49:42 +0200" Error: An error occurred while evaluating value of MyFirstModule.Home_Web.text1: Unparseable date: "Tue, 30 Mar 2021 10:49:42 +0200"   I can’t change the input, cause it’s out of a rss feed. Any ideas?
asked
6 answers
1

Have a look at the parseDateTime function, this lets you specify the format of the DateTime.

Something like this should work…
 

parseDateTime('Tue, 30 Mar 2021 10:49:42 +0200', 'EEE, d MMM YYYY hh:mm:ss Z')


To turn it back to a String, look at the formatDateTime function, using the same format string.

answered
0

same error….

toString(parseDateTime($currentObject/pubdate, 'EEE, dd MMM YYYY hh:mm:ss Z'))
An error occurred while evaluating value of Main.Home.text1: Unparseable date: "Wed, 31 Mar 2021 13:13:00 +0200" Error: An error occurred while evaluating value of Main.Home.text1: Unparseable date: "Wed, 31 Mar 2021 13:13:00 +0200"

 

answered
0

Check this at https://mydemoversion8-sandbox.mxapps.io/p/ff/ParseDateTime:

Have look what is going on: YYYY is resulting in a weird date, for which i have no explanation. You best stick with yyyy in small caps. these will give you the correct results, if you have set english as your language,

answered
0

 

English default language → same error

answered
0

Try to do it in steps in a microflow to test where you go wrong. Create a variable where you do the parseDateTime part and then create another variable where you do the to string part. If that all works as expected try to combine it in a third variable. The advantage is when you set a breakpoint in the microflow you can follow the steps and the values.

Regards,

Ronald

 

answered
0

Had the same problem. It seems thet the MMM expects the fitst three letters of the month, followed by a dot , so december should be dec. ) I think it is the default in Dutch locale.  I added an extra . in the string for myself, that did the trick...

answered