DayLight Saving Time Correction

General questions relating to Joomla! 1.5 There are other boards for more specific help on Joomla! features and extensions.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting.
Forum Post Assistant - If you are serious about wanting help, you should use this tool to help you post.
Post Reply
ghofrani
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Wed Sep 04, 2019 4:13 am

DayLight Saving Time Correction

Post by ghofrani » Mon Jun 20, 2022 6:26 pm

Hello,

DayLight Saving Time Correction :

For Gregorian Calendar :

Code: Select all

$user = JFactory::getUser();
$date = new JDate( $item->ctime);
if (date('I', time())) {
	$date->setOffset($user->getParam('timezone')+1);
} else {
	$date->setOffset($user->getParam('timezone'));
}
echo "<br/><span class='small'>".$date->toFormat( 'l , d F Y , h:i a' )."</span>";
For Jalali-Hijri Shamsi Calendar :

Code: Select all

$user = JFactory::getUser();
$date = new JDate( $item->ctime);
if (jdate('I', time())) {
	$date->setOffset($user->getParam('timezone')+1);
} else {
	$date->setOffset($user->getParam('timezone'));
}
echo "<br/><span class='small'>".$date->toFormat( 'l , d F Y , h:i a' )."</span>";
where jdate function can be downloaded here :
https://jdf.scr.ir/download

Thanks
Ghofrani

Post Reply

Return to “General Questions/New to Joomla! 1.5”