当前位置:网站首页>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
边栏推荐
- stm32Cubemx(8):RTC和RTC唤醒中断
- How to choose a panoramic camera that suits you?
- China as resin Market Research and investment forecast report (2022 Edition)
- 2022 U.S. college students' mathematical modeling e problem ideas / 2022 U.S. game e problem analysis
- 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
- 数论函数及其求和 待更新
- UE4/UE5 虚幻引擎,材质篇,纹理,Compression and Memory压缩和内存
- JVM 原理和流程简介
- LeetCode之单词搜索(回溯法求解)
猜你喜欢

django连接数据库报错,这是什么原因

AutoCAD - feature matching

Download the details and sequence of the original data access from the ENA database in EBI
![[groovy] closure (Introduction to closure class closure | closure parametertypes and maximumnumberofparameters member usage)](/img/1b/1fa2ebc9a6c5d271c9b39f5e508fb0.jpg)
[groovy] closure (Introduction to closure class closure | closure parametertypes and maximumnumberofparameters member usage)

"Measuring curve length" of CAD dream drawing

SQL set operation

AutoCAD -- dimension break

MySQL in-depth learning - index creation and deletion, index design principles, index failure scenarios, query optimization, index push down ICP

Use assimp library to read MTL file data
![[groovy] closure (Introduction to closure class closure | this, owner, delegate member assignment and source code analysis)](/img/aa/3c8b7b27e322417777d1315b9a5a8f.jpg)
[groovy] closure (Introduction to closure class closure | this, owner, delegate member assignment and source code analysis)
随机推荐
Séparation et combinaison de la construction du système qualité
质量体系建设之路的分分合合
Wan broadband access technology V EPON Technology
Emlog blog theme template source code simple good-looking responsive
Function overloading
Research and investment forecast report of adamantane industry in China (2022 Edition)
The difference between heap and stack
Unity connects to the database
How to choose a panoramic camera that suits you?
Redis 排查大 key 的4种方法,优化必备
[groovy] closure (Introduction to closure class closure | this, owner, delegate member assignment and source code analysis)
AutoCAD -- dimension break
Sixth note
C # perspective following
Difference between singleton and factory pattern
54. 螺旋矩阵 & 59. 螺旋矩阵 II ●●
[groovy] closure closure (customize closure parameters | customize a single closure parameter | customize multiple closure parameters | specify the default value of closure parameters)
Introduction to JVM principle and process
Thinking of 2022 American College Students' mathematical modeling competition
Minor spanning tree