Diff

util/datetime.lua @ 5107:6ac790efecd3

util.datetime: Fix timestamp parsing pattern.
author Waqas Hussain <waqas20@gmail.com>
date Tue, 28 Aug 2012 05:08:18 +0500
parent 4250:7b456af75c77
child 5776:bd0ff8ae98a8
line wrap: on
line diff
--- a/util/datetime.lua	Sun Aug 26 22:54:10 2012 +0000
+++ b/util/datetime.lua	Tue Aug 28 05:08:18 2012 +0500
@@ -36,7 +36,7 @@
 function parse(s)
 	if s then
 		local year, month, day, hour, min, sec, tzd;
-		year, month, day, hour, min, sec, tzd = s:match("^(%d%d%d%d)-?(%d%d)-?(%d%d)T(%d%d):(%d%d):(%d%d)%.?%d*([Z+%-].*)$");
+		year, month, day, hour, min, sec, tzd = s:match("^(%d%d%d%d)%-?(%d%d)%-?(%d%d)T(%d%d):(%d%d):(%d%d)%.?%d*([Z+%-]?.*)$");
 		if year then
 			local time_offset = os_difftime(os_time(os_date("*t")), os_time(os_date("!*t"))); -- to deal with local timezone
 			local tzd_offset = 0;