Jump to content

Recommended Posts

Hello,

wisch you a happy new year!

 

Can you help me to find a regexp pattern for replacing timestamps in a csv file please.

 

I have this Format in the file: 21.07.2019;14:12:10 (dd.mm.yyyy;hh:mm:ss)

but I Need this: 2019-07-21 00:00:00 (yyyy-mm-dd hh:mm:ss)

 

Thanks, would be great if you can help me.

P.S.: I want to use StringRegExpReplace for the hole file/string.

 

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to post
Share on other sites

Thanks a lot, works great! (without 00:00:00, because I made an error; time has to be the same)

Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to post
Share on other sites

 

Local $sInput = "Date Line 01 = 21.07.2019;14:12:10 " & @CRLF & _
                "Date Line 02 = 29.03.2014;03:04:59 " & @CRLF & _
                "Date Line 03 = 03.12.2013;22:41:15 "
Local $sOutput = StringRegExpReplace($sInput, "(\d{2})\.(\d{2})\.(\d{4});(\d{2}):(\d{2}):(\d{2})", "\3-\2-\1 \4:\5:\6")
ConsoleWrite($sInput & @CRLF & @CRLF)
ConsoleWrite($sOutput & @CRLF)

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...