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

边栏推荐
- Mfc a dialog calls B dialog function and passes parameters
- 微信小程序使用towxml显示公式
- Bit by bit of OpenCV calling USB camera
- taobao. trade. Get (get some information of a single transaction), Taobao store order interface, Taobao oauth2.0 interface, Taobao R2 interface code docking and sharing
- MFC CString to char*
- vChain: Enabling Verifiable Boolean Range Queries over Blockchain Databases(sigmod‘2019)
- Kityformula editor configure font size and spacing
- Fundamentals of software testing
- Why can't browsers read JSX?
- CDN 在游戏领域的应用
猜你喜欢

Fatal: unsafe repository is owned by someone else

C#代码审计实战+前置知识

Table responsive layout tips

kityformula-editor 配置字号和间距

YoloV6训练:训练自己数据集遇到的各种问题

How does CTO help the business?

The past and present lives of visual page building tools

Kityformula editor configure font size and spacing

C code audit practice + pre knowledge

.NET Core 日志系统
随机推荐
Sharp tool SPL for post SQL calculation
MFC A对话框调用B对话框函数并传参
C RichTextBox controls the maximum number of lines displayed
Dragonfly low code security tool platform development path
MFC console printing, pop-up dialog box
btrace-(字节码)动态跟踪工具
Fatal: unsafe repository is owned by someone else
TiDB 软件和硬件环境建议配置
Leetcode - Search 2D matrix
qml 弹窗框架,可定制
[development environment] install the visual studio community 2013 development environment (download the installation package of visual studio community 2013 with update 5 version)
用户隐私协议有些汉字编码不规范导致网页显示乱码,需要统一找出来处理一下
學習使用php實現公曆農曆轉換的方法代碼
如何用 Sysbench 测试 TiDB
记一次报错解决经历依赖重复
kityformula-editor 配置字号和间距
AtCoder Beginner Contest 254
可视化搭建页面工具的前世今生
[QNX Hypervisor 2.2用户手册]6.3 Guest与外部之间通信
taobao. trades. sold. Get query the transaction data that the seller has sold (according to the creation time), Taobao store sales order query API interface, Taobao R2 interface, Taobao oauth2.0 trans