scott_boss
(scott boss)
December 12, 2016, 7:28pm
#1
I have the following string Fri Dec 9 00:00:00 UTC-05:00 2016
(as an example) that I need to convert into SQLDateTime format. Is there an easy RexEx pattern to do the conversion or is it going to be more complicated due to the format?
I bet @Kem Tekinay will have the code off the top of his head.
Thanks!
sb
You can use a regex to pick out the parts, but that’s about it. You’ll have to write code to do the actual conversion.
^\\w{3} (\\w{3}) (\\d{1,2}) (\\d{2}:\\d{2}:\\d{2}) (UTC[^\\x20]+) (\\d{4})
$1 = Month
$2 = Day
$3 = Time
$4 = Time zone
$5 = Year
If the month was given in number format and the day in two-digit format, you could use a replacement pattern like this:
$5-$1-$2 $3
But alas…
scott_boss
(scott boss)
December 12, 2016, 8:29pm
#3
[quote=302923:@Kem Tekinay]You can use a regex to pick out the parts, but that’s about it. You’ll have to write code to do the actual conversion.
^\\w{3} (\\w{3}) (\\d{1,2}) (\\d{2}:\\d{2}:\\d{2}) (UTC[^\\x20]+) (\\d{4})
$1 = Month
$2 = Day
$3 = Time
$4 = Time zone
$5 = Year
If the month was given in number format and the day in two-digit format, you could use a replacement pattern like this:
$5-$1-$2 $3
But alas…[/quote]
thank you.