当前位置:网站首页>Learn the method code example of converting timestamp to uppercase date using PHP
Learn the method code example of converting timestamp to uppercase date using PHP
2022-07-02 15:07:00 【Lingering memory of Yu Fei】
Learn to use php Method code example of converting timestamp to uppercase date
design sketch
Current date in lowercase -----2022-06-27 17:45:25
The current date is capitalized ----- Two 〇 June 27, 2002
The current date is capitalized ----- June 27, 2002
Encapsulation method
function dateTimeToUpper($stamp, $type)
{
$year = str_split(date('Y', $stamp));
$month = intval(date('m', $stamp));
$day = intval(date('d', $stamp));
$chars = array(
0 => ['〇', ' zero '],
1 => [' One ', ' one '],
2 => [' Two ', ' Ii. '],
3 => [' 3、 ... and ', ' 3 '],
4 => [' Four ', ' boss '],
5 => [' 5、 ... and ', ' wu '],
6 => [' 6、 ... and ', ' lu '],
7 => [' 7、 ... and ', ' Retailer, '],
8 => [' 8、 ... and ', ' '],
9 => [' Nine ', ' nine '],
10 => [' Ten ', ' Ten '],
11 => [' 11、 ... and ', ' Ten '],
12 => [' Twelve ', ' twelve '],
13 => [' 13、 ... and ', ' Thirteen '],
14 => [' fourteen ', ' Forty four '],
15 => [' 15、 ... and ', ' fifteen '],
16 => [' sixteen ', ' sixteen '],
17 => [' seventeen ', ' seventeen '],
18 => [' eighteen ', ' eighteen '],
19 => [' nineteen ', ' nineteen '],
20 => [' twenty ', ' twenty '],
21 => [' The 21st ', ' Twenty one '],
22 => [' Twenty-two ', ' twenty-two '],
23 => [' 23 ', ' twenty-three '],
24 => [' Twenty-four ', ' Twenty four '],
25 => [' twenty-five ', ' Twenty five '],
26 => [' hexacosa- ', ' Twenty six '],
27 => [' twenty-seven ', ' Twenty seven '],
28 => [' Twenty-eight ', ' Twenty eight '],
29 => [' Twenty-nine ', ' Twenty nine '],
30 => [' thirty ', ' thirty '],
31 => [' Thirty-one ', ' Thirty one '],
);
$date = '';
foreach ($year as $y) {
$date .= $chars[$y][$type];
}
$date .= ' year ';
$date .= $chars[$month][$type] . ' month ';
$date .= $chars[$day][$type] . ' Japan ';
return $date;
}
echo ' Current date in lowercase ==' . $now_time = date('Y-m-d H:i:s', time());
echo '<br>';
echo ' The current date is capitalized = The first style =' . dateTimeToUpper(time(), 0);
echo '<br>';
echo ' The current date is capitalized = The second style =' . dateTimeToUpper(time(), 1);
echo '<br>';
边栏推荐
- TiDB数据迁移工具概览
- php获取数组中键值最大数组项的索引值的方法
- AtCoder Beginner Contest 254
- c语言入门--数组
- JMeter script parameterization
- [QNX hypervisor 2.2 user manual]6.3 communication between guest and external
- Arithmetic operations and related exercises in C language
- MFC timer usage
- Have you learned the wrong usage of foreach
- 富文本编辑器添加矢量公式(MathType for TinyMCE ,可视化添加)
猜你喜欢
kibana 基础操作
Xilinx Vivado set *. svh as SystemVerilog Header
[noi Simulation Competition] scraping (dynamic planning)
【C语言】详解指针的初阶和进阶以及注意点(1)
C#代码审计实战+前置知识
Onnx+tensorrt: write preprocessing operations to onnx and complete TRT deployment
使用mathtype编辑公式,复制粘贴时设置成仅包含mathjax语法的公式
TiDB数据迁移工具概览
Ad20 cannot select the solution of component packaging in PCB editor
LeetCode 2310. The number of digits is the sum of integers of K
随机推荐
Internet Explorer officially retired
MFC timer usage
C # delay, start the timer in the thread, and obtain the system time
Printf function and scanf function in C language
TiDB跨数据中心部署拓扑
[apipost] tutorial
C语言中的算术运算及相关练习题
TiDB混合部署拓扑
原则、语言、编译、解释
buuctf-pwn write-ups (7)
C语言中的printf函数和scanf函数
Leetcode - Search 2D matrix
jmeter脚本参数化
MFC A对话框调用B对话框函数并传参
LeetCode - 搜索二维矩阵
可视化搭建页面工具的前世今生
编译原理课程实践——实现一个初等函数运算语言的解释器或编译器
Reuse and distribution
XML配置文件
华为面试题: 没有回文串