当前位置:网站首页>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
边栏推荐
- Is $20billion a little less? Cisco is interested in Splunk?
- 中国针状焦行业发展研究与投资价值报告(2022版)
- 质量体系建设之路的分分合合
- MySQL audit log archiving
- 2022 U.S. college students' mathematical modeling e problem ideas / 2022 U.S. game e problem analysis
- 2022 thinking of Mathematical Modeling B problem of American college students / analysis of 2022 American competition B problem
- How much do you know about 3DMAX rendering skills and HDRI light sources? Dry goods sharing
- GameObject class and transform class of unity
- C # perspective following
- MySQL in-depth learning - index creation and deletion, index design principles, index failure scenarios, query optimization, index push down ICP
猜你喜欢
"Measuring curve length" of CAD dream drawing
[AI bulletin 20220211] the hard core up owner has built a lidar and detailed AI accelerator
3dsmax scanning function point connection drawing connection line
How to choose a panoramic camera that suits you?
Understand encodefloatrgba and decodefloatrgba
[groovy] closure (Introduction to closure class closure | closure parametertypes and maximumnumberofparameters member usage)
2022 American College Students' mathematical modeling ABCDEF problem thinking /2022 American match ABCDEF problem analysis
Emlog博客主题模板源码简约好看响应式
54. Spiral matrix & 59 Spiral matrix II ●●
Solution of circular dependency
随机推荐
【acwing】240. food chain
AutoCAD - set layer
The 22nd Spring Festival Gala, an immersive stage for the yuan universe to shine into reality
Special information | finance, accounting, audit - 22.1.23
Unity connects to the database
#775 Div.1 B. Integral Array 数学
Rip notes [rip message security authentication, increase of rip interface measurement]
【acwing】836. Merge sets
This article is good
Unity parallax infinite scrolling background
【acwing】528. cheese
C iterator
Establish cloth effect in 10 seconds
2022 thinking of mathematical modeling a problem of American college students / analysis of 2022 American competition a problem
Thematic information | carbon, carbon neutrality, low carbon, carbon emissions - 22.1.9
質量體系建設之路的分分合合
Special information | real estate and office buildings - 22.1.9
AutoCAD - window zoom
Database under unity
中国溶聚丁苯橡胶(SSBR)行业研究与预测报告(2022版)