这是我的表架构:
CREATE TABLE Orders
(
OrderDate TIMESTAMP NOT NULL DEFAULT NOW(),
)
当我插入一行时,我的输出将是这样的:
+---------------------+
| 2015-08-01 16:22:47 | // Gregorian date
+---------------------+
现在我需要将其转换为 Solar 日期,如下所示:
+---------------------+
| 1394-05-10 16:22:47 | // Solar date
+---------------------+
我该怎么做?
我有一个想法,我可以使用unix_timestamp
将日期(格里高利)更改为时间戳(例如:1438438368
),然后加上1348-10-11
({ {1}})
实际上我需要加上一个像这样的数字的日期:
1348-10-11 = 1970-01-01
我该怎么做?
答案 0 :(得分:2)
使用JDF。
$now = time();
jdate('Y-m-d h:i:s',$now)
答案 1 :(得分:1)
以下是解决方案:
<?php
$fmt = new IntlDateFormatter("fa_IR@calendar=persian", IntlDateFormatter::FULL, IntlDateFormatter::FULL, 'Asia/Tehran', IntlDateFormatter::TRADITIONAL);
echo $fmt->format(time());
?>