$hour = date("G"); // Get hour of current time without leading zerosswitch ($hour) { case 1: case 2: echo '<link rel="stylesheet" type="text/css" href="morning.css"/>'; break; case 3: case 4: echo '<link rel="stylesheet" type="text/css" href="evening.css"/>'; break; ...}
$hour = date("G"); // Get hour of current time without leading zerosswitch ($hour) { case 1: case 2: echo '<link rel="stylesheet" type="text/css" href="morning.css"/>'; break; case 3: case 4: echo '<link rel="stylesheet" type="text/css" href="evening.css"/>'; break; default : echo '<link rel="stylesheet" type="text/css" href="default.css"/>'; break;}
<?php $myDT = new DateTime('now', new DateTimeZone('Europe/Athens'));$hour = gmdate('G', time() + $myDT->getOffset());unset($myDT);if ($hour > 19) { //night 20:00 - 23:59 $cssfile = 'night';} else if ($hour > 16) { //afternoon 17:00 - 19:59 $cssfile = 'afternoon';} else if ($hour > 11) { //noon 12:00 - 16:59 $cssfile = 'noon';} else if ($hour > 6) { //morning 07:00 - 11:59 $cssfile = 'morning';} else { //night again 00:00 - 06:59 $cssfile = 'night';}echo '<link rel="stylesheet" type="text/css" href="'.$mainframe->getCfg('ssl_live_site').'/templates/'.$mainframe->getTemplate().'/css/template_css.css" />';echo '<link rel="stylesheet" type="text/css" href="'.$mainframe->getCfg('ssl_live_site').'/templates/'.$mainframe->getTemplate().'/css/'.cssfile .'.css" />';?>
<?php $hour = eFactory::getDate()->worldDate('now', 'Europe/Athens', 'G');?>
<?php echo '<link rel="stylesheet" type="text/css" href="'.$mainframe->getCfg('ssl_live_site').'/templates/'.$mainframe->getTemplate().'/css/template_css.css" />';?><script type="text/javascript">/* <![CDATA[ */var client_date = new Date();var client_hour = client_date.getHours();client_hour = parseInt(client_hour);if (client_hour > 19) { //night 20:00 - 23:59 var cssfile = 'night';} else if (client_hour > 16) { //afternoon 17:00 - 19:59 var cssfile = 'afternoon';} else if (client_hour > 11) { //noon 12:00 - 16:59 var cssfile = 'noon';} else if (client_hour > 6) { //morning 07:00 - 11:59 var cssfile = 'morning';} else { //night again 00:00 - 06:59 var cssfile = 'night';}var custom_css = '<link rel="stylesheet" type="text/css" href="<?php echo $mainframe->getCfg('ssl_live_site'); ?>';custom_css += '/templates/<?php echo $mainframe->getTemplate(); ?>/css/'+cssfile+'.css" />';document.write(custom_css);/* ]]> */</script>