Change CSS according to Timezone-specific Date


/ Published in: PHP
Save to your folder(s)

Date format guide:

d = 01 to 12 ;
m = 01 to 12 ;

More formats: http://php.net/manual/en/function.date.php


Copy this code and paste it in your HTML
  1. <?php
  2.  
  3. date_default_timezone_set('Asia/Hong_Kong');
  4.  
  5. if( date('d m') == '01 04' ) {
  6. echo '<link rel="stylesheet" href="style.css" type="text/css" media="screen" />';
  7. } else {
  8. echo '<link rel="stylesheet" href="style_2.css" type="text/css" media="screen" />';
  9. }
  10.  
  11. ?>

URL: http://wordpress.org/support/topic/change-css-according-to-date

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.