Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Date convert
#1
str="ababababab 12343434 Dec 10 02:13:21 0.00 31.03 4[]acabasdfefa 35345345 1287 xcxc Dec 9 20:10:15 0.00 28.14 3"

How can I extract the dates and convert them to QM format?
#2
Code:
Copy      Help
str s=
;ababababab 12343434 Dec 10 02:13:21 0.00 31.03 4
;acabasdfefa 35345345 1287 xcxc Dec 9 20:10:15 0.00 28.14 3


ARRAY(str) a
if(!findrx(s "\b(Jan|Dec|othermonths) (\d+) (\d+):(\d+):(\d+)" 0 4 a)) out "failed"

int i
for i 0 a.len
,out "%s, %s, %s, %s, %s, %s" a[0 i] a[1 i] a[2 i] a[3 i] a[4 i] a[5 i]
,;now format as you like
,
#3
Thanks.

I thought that had a direct way of extracting dates with regex
#4
How can I convert "10 Ene 2007 12:23:00" -->"10 Jan 2007 12:23:00"? (different time zone.)
#5
s.findreplace("Ene" "Jan" 2)
#6
What I was looking for is a way to change any time in any time zone.
#7
Convert date format to specified locale, or change hours to specified timezone?

Actually I don't know how to do either but have some ideas.


Forum Jump:


Users browsing this thread: 1 Guest(s)