How to store date in database based on different c

2019-08-14 17:58发布

问题:

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