I'm gonna change current date to new date in php, In following code current date shows on page in Persian calendar, but it doesn't change real Gregorian date.
For example: If we stored date: 2015-01-03 in database, this code convert this date to new date in Persian Calendar and it will show it on page.
public static function localDate($date = "")
{
$local = "";
switch (strlen($date))
{
default: // Ymd
{
if (( $date < '19700101'))
{
$local = $date;
break;
}
else
{
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;
}
}
break;
}
return $local;
}
Here is jdatetime.class.php
Question: How can I change current date to new date in server? I'm gonna store date based on Persian Calendar How to changed server date from Gregorian to Persian calendar?
Here's sample of my problem:
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…