diff options
Diffstat (limited to 'lib/date.lua')
-rw-r--r-- | lib/date.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/date.lua b/lib/date.lua index cdc6ad0..d28cc74 100644 --- a/lib/date.lua +++ b/lib/date.lua @@ -9,7 +9,7 @@ require("fs") --global for date formating see below for more information --Mon Nov 26 19:56:10 UTC 2007 looks like most systems use this --print(os.date(date.format)) -format = "%a %b %d %X %Z %Y" +formats = "%a %b %d %X %Z %Y" months ={ {"January","Jan"}, {"February", "Feb"}, @@ -202,19 +202,19 @@ function seconds_to_date (t) g = {} count = table.maxn(t) for i = 1,count do - g[#g+1] = os.date(format,t[i]) + g[#g+1] = os.date(formats,t[i]) end return g end --Wed Nov 28 14:01:23 UTC 2007 ---os.date(date.format) put into a table +--os.date(date.formats) put into a table --year,month,day,hour,min,sec,isdst- may need a dst table to set this automatically function string_to_table (str) - if str == nil then str = os.date(format) end + if str == nil then str = os.date(formats) end g = {} - temp = format.string_to_table("%s",str) + temp = format.string_to_table(str,"%s") month = abr_month_num(temp[2]) g["month"] = month day = temp[3] @@ -223,7 +223,7 @@ function string_to_table (str) tz = temp[5] year = temp[6] g["year"] = year - temp2 = format.string_to_table(":",temp[4]) + temp2 = format.string_to_table(temp[4],":") hour = temp2[1] g["hour"] = hour min = temp2[2] |