当前位置:网站首页>Time format conversion
Time format conversion
2022-07-05 04:56:00 【Meteor spot】
-- Convert time seconds to 2018-10-1 10:10:20 Format
local function timestamp(ct)
local t = os.date("*t",ct)
return string.format("%04d-%02d-%02d %02d:%02d:%02d", t.year, t.month, t.day, t.hour, t.min, t.sec)
end
-- Convert numbers into uppercase Chinese characters for display
function App.toChineseCapital(num)
local cnum = {" zero ", " one ", " Ii. ", " 3 ", " boss ", " wu ", " lu ", " Retailer, ", " ", " nine "}
local cunit = {" Ten ", " Bai ", " Thousand ", " ten thousand ", " Ten ", " Bai ", " Thousand ", " Billion "}
num = math.floor(num)
local result = ""
local zero = true
local count = 0
local whole = ""
while num > 0 do
local n = num % 10 + 1
if n == 1 then
if count > 0 and count % 4 == 0 then
if count % 8 == 0 then
whole = cunit[8]
else
whole = cunit[4]
end
end
if not zero and count % 4 ~= 0 then
result = cnum[n] .. result
end
zero = true
else
local c = count % 8
if count > 0 and c == 0 then
c = 8
end
if c == 4 or c == 8 then
whole = ""
end
local unit = cunit[c] or ""
result = string.format("%s%s%s%s", cnum[n], unit, whole, result)
zero = false
whole = ""
end
count = count + 1
num = math.floor(num / 10)
end
return result
end
边栏推荐
- Autocad-- Real Time zoom
- Detailed explanation of the ranking of the best universities
- LeetCode之單詞搜索(回溯法求解)
- Research and forecast report on China's solution polymerized styrene butadiene rubber (SSBR) industry (2022 Edition)
- Thinking of 2022 American College Students' mathematical modeling competition
- AutoCAD - Zoom previous
- 【acwing】836. Merge sets
- Judge the position of the monster in the role under unity3d
- AutoCAD - graphic input and output
- Redis has four methods for checking big keys, which are necessary for optimization
猜你喜欢
C4D simple cloth (version above R21)
PostgreSQL surpasses mysql, and the salary of "the best programming language in the world" is low
Rip notes [rip message security authentication, increase of rip interface measurement]
Looking at Chinese science and technology from the Winter Olympics: what is the mystery of the high-speed camera that the whole people thank?
【acwing】837. Number of connected block points
django连接数据库报错,这是什么原因
質量體系建設之路的分分合合
XSS injection
3dsmax snaps to frozen objects
Solutions and answers for the 2021 Shenzhen cup
随机推荐
AutoCAD - set layer
[groovy] closure (closure parameter binding | curry function | rcurry function | ncurry function | code example)
AutoCAD - stretching
Panel panel of UI
Wan broadband access technology V EPON Technology
Error statuslogger log4j2 could not find a logging implementation
2021 huashubei mathematical modeling idea + reference + paper
用 Jmeter 工具做个小型压力测试
2022 thinking of mathematical modeling D problem of American college students / analysis of 2022 American competition D problem
Unity3d learning notes
2021 Higher Education Club Cup mathematical modeling national tournament ABCD problem - problem solving ideas
Detailed introduction of OSPF header message
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)
[groovy] closure (closure parameter list rule | default parameter list | do not receive parameters | receive custom parameters)
[ideas] 2021 may day mathematical modeling competition / May Day mathematical modeling ideas + references + codes
Fluent objects and lists
Number theoretic function and its summation to be updated
Sqlserver stored procedures pass array parameters
中国聚氨酯硬泡市场调研与投资预测报告(2022版)
#775 Div.1 B. Integral Array 数学