AnsweredAssumed Answered

How do I convert this date?

Question asked by Marek Kaszycki on Jan 15, 2019
Latest reply on Jan 15, 2019 by Marek Kaszycki

Hi,

 

There's yet another stubborn date that resists being converted:

Tue, 27 Nov 2018 15:58:21 +0100 (GMT+01:00)

If the date was this:
Tue, 27 Nov 2018 15:58:21 +0100

It would be enough to use this regex:

^\w{3},\s\d{1,2}\s\w{3}\s\d{4}\s\d{1,2}:\d{1,2}:\d{1,2}\s[\+\-]\d{1,4}

And this capturing group:

EEE, d MMM yyyy HH:mm:ss X

I have other dates like that, so I know this works with offset like "+0100".

 

I've tried a couple of things to solve this, but nothing worked. I'm stuck at this regex now:

^\w{3},\s\d{1,2}\s\w{3}\s\d{4}\s\d{1,2}:\d{1,2}:\d{1,2}\s[\+\-]\d{1,4}(?:.*)

It should work, I don't know why it's not working. I tried other groupings, too:

^\w{3},\s\d{1,2}\s\w{3}\s\d{4}\s\d{1,2}:\d{1,2}:\d{1,2}\s[\+\-]\d{1,4}(?=.*)

^\w{3},\s\d{1,2}\s\w{3}\s\d{4}\s\d{1,2}:\d{1,2}:\d{1,2}\s[\+\-]\d{1,4}(?>.*)

None of them work.

Outcomes