Comparison

util/datetime.lua @ 921:f97d37a7d8a6

util.datetime: Allow specifying a time to format
author Matthew Wild <mwild1@gmail.com>
date Sun, 29 Mar 2009 02:14:32 +0100
parent 896:2c0b9e3c11c3
child 1523:841d61be198f
comparison
equal deleted inserted replaced
920:e302cbc9d036 921:f97d37a7d8a6
12 local os_date = os.date; 12 local os_date = os.date;
13 local error = error; 13 local error = error;
14 14
15 module "datetime" 15 module "datetime"
16 16
17 function date() 17 function date(t)
18 return os_date("!%Y-%m-%d"); 18 return os_date("!%Y-%m-%d", t);
19 end 19 end
20 20
21 function datetime() 21 function datetime(t)
22 return os_date("!%Y-%m-%dT%H:%M:%SZ"); 22 return os_date("!%Y-%m-%dT%H:%M:%SZ", t);
23 end 23 end
24 24
25 function time() 25 function time(t)
26 return os_date("!%H:%M:%S"); 26 return os_date("!%H:%M:%S", t);
27 end 27 end
28 28
29 function legacy() 29 function legacy(t)
30 return os_date("!%Y%m%dT%H:%M:%S"); 30 return os_date("!%Y%m%dT%H:%M:%S", t);
31 end 31 end
32 32
33 function parse(s) 33 function parse(s)
34 error("datetime.parse: Not implemented"); -- TODO 34 error("datetime.parse: Not implemented"); -- TODO
35 end 35 end