doubao6936 2015-10-27 23:55
浏览 148

如何根据不同的日历在数据库中存储日期?

I'm gonna change current local date to new local date and time. As something I know, This is the code: For example:

date_default_timezone_set("Asia/Calcutta");
date_default_timezone_get(); // Show current date & time

or using third party to change date, something like this:

    header('Content-Type: text/html; charset=UTF-8');
    require_once dirname(__FILE__) . '/jdatetime.class.php';
    $local = jDateTime::date("l j F Y", strtotime($date), true, true, 'Asia/Tehran');
    break;

These ways only can set time & date based on local time zone & date, but it won't change current date in fact based on another calendars. More information

For example:

Today is in Gregorian Calendar: 2015 - Oct - 27

Today is in Hebrew Calendar: 5776 - 08 - 14

Today is in Hijri Calendar: 1437 - 01 - 14

Today is in Persian Calendar: 1394 - 08 - 06

I tried most of ways to change current date to another date, but actually all the ways I tried just will convert Gregorian calendar to another calendars but it can not physically change local date.

I mean if we will store date into database, it will store based on Gregorian Calendar but it will show it based on another calendars. (( Depends on settings how you set date default or third party ))

Q: Is there any way to change physically local date in server using php or there's no anyway ?

Thanks in advance for any comment on this issue.

some of the ways I tried are:

Hijri, jDateTime, Jewish, php.ini, timezone, default timezone

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 #MATLAB仿真#车辆换道路径规划
    • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
    • ¥15 数据可视化Python
    • ¥15 要给毕业设计添加扫码登录的功能!!有偿
    • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘