diff options
author | Mike Mason <ms13sp@gmail.com> | 2007-11-28 15:26:13 +0000 |
---|---|---|
committer | Mike Mason <ms13sp@gmail.com> | 2007-11-28 15:26:13 +0000 |
commit | dbddbd9b0cec1bfe8e92a39552b28ab2f11195d9 (patch) | |
tree | 94bf4751bfb9f58f6854244d98d9cfac1852fc03 /lib/date.lua | |
parent | 7538b26d89faab270cd90ea72415d4dd2c988708 (diff) | |
download | acf-core-dbddbd9b0cec1bfe8e92a39552b28ab2f11195d9.tar.bz2 acf-core-dbddbd9b0cec1bfe8e92a39552b28ab2f11195d9.tar.xz |
added split and join to fs.lua and gave them function names so we don't have to strsplit = require split. Added a date string to table function in date.lua
git-svn-id: svn://svn.alpinelinux.org/acf/core/trunk@378 ab2d0c66-481e-0410-8bed-d214d4d58bed
Diffstat (limited to 'lib/date.lua')
-rw-r--r-- | lib/date.lua | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/lib/date.lua b/lib/date.lua index a7ed872..0a236cc 100644 --- a/lib/date.lua +++ b/lib/date.lua @@ -3,6 +3,7 @@ module(..., package.seeall) require("posix") +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 @@ -89,6 +90,33 @@ function seconds_to_date (t) return g end +--Wed Nov 28 14:01:23 UTC 2007 +--os.date(date.format) 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 + g = {} + temp = fs.string_to_table("%s",str) + month = abr_month_num(temp[2]) + g["month"] = month + day = temp[3] + g["day"] = day + --may do something with this if have a tz table ?? + tz = temp[5] + year = temp[6] + g["year"] = year + temp2 = fs.string_to_table(":",temp[4]) + hour = temp2[1] + g["hour"] = hour + min = temp2[2] + g["min"] = min + sec = temp2[3] + g["sec"] = sec + return g + +end + + --give dates in seconds and gives the difference in years,months,days,... --gives a table back with hour,min,month,sec,day,year to display something like --you have 10 years, 14 hours, 10 days to renew you certificate |