6 local time
= os
.date("*t", os
.time())
10 <form action="system_time.cgi" method="post">
11 <input type="hidden" name="todo" value="newdatetime" />
12 <table cellpadding="8" cellspacing="2" border="0">
14 <td class="color_table_heading" align="right"><strong>日期:</strong></td>
15 <td class="color_table_row1">
20 if year
==tonumber(time
.year
) then
21 print([[<option value="]]..year
..[[" selected="selected">]]..year
..[[</option>]])
23 print([[<option value="]]..year
..[[">]]..year
..[[</option>]])
26 if tonumber(time
.year
) < 2008 then
27 print([[<option value="]]..time
.year
..[["selected="selected">]]..time
.year
..[[</option>]])
35 m
= string.format("%02d", month
)
36 if month
==tonumber(time
.month
) then
37 print([[<option value="]]..m
..[[" selected="selected">]]..m
..[[</option>]])
39 print([[<option value="]]..m
..[[">]]..m
..[[</option>]])
42 print([[</select><select name="day">]])
45 d
= string.format("%02d", day
)
46 if day
==tonumber(time
.day
) then
47 print([[<option value="]]..d
..[[" selected="selected">]]..d
..[[</option>]])
49 print([[<option value="]]..d
..[[">]]..d
..[[</option>]])
58 <td class="color_table_heading" align="right"><strong> 时间:</strong></td>
59 <td class="color_table_row2">
63 local h
= string.format("%02d", hour
)
64 if hour
==tonumber(time
.hour
) then
65 print([[<option value="]]..h
..[[" selected="selected">]]..h
..[[</option>]])
67 print([[<option value="]]..h
..[[">]]..h
..[[</option>]])
73 <select name="minute">
76 local m
= string.format("%02d", min)
77 if min==tonumber(time
.min) then
78 print([[<option value="]]..m
..[[" selected="selected">]]..m
..[[</option>]])
80 print([[<option value="]]..m
..[[">]]..m
..[[</option>]])
88 <td colspan="2" align="center"><input type="submit" name="actionnewdatetime" value="设置时间日期" /></td>
97 local time
= t
.month
..t
.day
..t
.hour
..t
.minute
..t
.year
99 err
,ret
= myexec("sudo /bin/date "..time
)
100 if ret
~= 0 then ui_message_err(err
) return nil end
101 print("设置时间 ... <font color=green><strong>成功</strong></font>")
103 local qp
= ui_getqp()