当前位置:网站首页>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>';

边栏推荐
猜你喜欢
随机推荐
C#延时、在线程中开启定时器、获取系统时间
Simple verification code generator for 51 single chip microcomputer experiment
taobao. trade. memo. Add (add remarks to a transaction) interface, Taobao store flag insertion interface, Taobao order flag insertion API interface, oauth2.0 interface
tmall. product. schema. Get (product information acquisition schema acquisition), Taobao store upload commodity API interface, Taobao commodity publishing interface, Taobao commodity upload API interf
HUSTPC2022
CTO如何帮助业务?
TiDB混合部署拓扑
About text selection in web pages and counting the length of selected text
jmeter脚本参数化
LeetCode 209. Minimum length subarray
Why can't programmers who can only program become excellent developers?
AtCoder Beginner Contest 254
Xilinx Vivado set *. svh as SystemVerilog Header
MFC 控制台打印,弹出对话框
Add vector formula in rich text editor (MathType for TinyMCE, visual addition)
Database connection pool and data source
Mavn 搭建 Nexus 私服
TiDB 环境与系统配置检查
ONNX+TensorRT:将预处理操作写入ONNX并完成TRT部署
TiDB数据迁移工具概览









