2025年01月20日 建站教程
如何利用php语法将时间戳转为“年月日”格式,如何将“年月日”格式转换成时间戳?下面web建站小编给大家详细介绍一下具体实现代码!
将时间戳转为“年月日”格式
// 获取当前时间戳
$timestamp = time(); 
 // 转换为年月日格式
$date = date('Y-m-d', $timestamp);
// 输出 2023-03-28
echo $date; 
将“年月日”格式转换成时间戳
$timestamp = strtotime('2023-03-28');
echo $timestamp; 
			
                                        本文链接:http://so.lmcjl.com/news/21689/