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">
19 d
= string.format("%02d", day
)
20 if day
==tonumber(time
.day
) then
21 print([[<option value="]]..d
..[[" selected="selected">]]..d
..[[</option>]])
23 print([[<option value="]]..d
..[[">]]..d
..[[</option>]])
32 m
= string.format("%02d", month
)
33 if month
==tonumber(time
.month
) then
34 print([[<option value="]]..m
..[[" selected="selected">]]..m
..[[</option>]])
36 print([[<option value="]]..m
..[[">]]..m
..[[</option>]])
39 print([[</select><select name="year">]])
41 if year
==tonumber(time
.year
) then
42 print([[<option value="]]..year
..[[" selected="selected">]]..year
..[[</option>]])
44 print([[<option value="]]..year
..[[">]]..year
..[[</option>]])
47 if tonumber(time
.year
) < 2008 then
48 print([[<option value="]]..time
.year
..[["selected="selected">]]..time
.year
..[[</option>]])
56 <td class="color_table_heading" align="right"><strong> 时间:</strong></td>
57 <td class="color_table_row2">
61 local h
= string.format("%02d", hour
)
62 if hour
==tonumber(time
.hour
) then
63 print([[<option value="]]..h
..[[" selected="selected">]]..h
..[[</option>]])
65 print([[<option value="]]..h
..[[">]]..h
..[[</option>]])
71 <select name="minute">
74 local m
= string.format("%02d", min)
75 if min==tonumber(time
.min) then
76 print([[<option value="]]..m
..[[" selected="selected">]]..m
..[[</option>]])
78 print([[<option value="]]..m
..[[">]]..m
..[[</option>]])
86 <td colspan="2" align="center"><input type="submit" name="actionnewdatetime" value="设置时间日期" /></td>
95 local time
= t
.month
..t
.day
..t
.hour
..t
.minute
..t
.year
97 err
,ret
= myexec("sudo date "..time
)
98 if ret
~= 0 then ui_message_err(err
) return nil end
99 print("设置时间 ... <font color=green><strong>成功</strong></font>")
101 local qp
= ui_getqp()