Set Your Site’s Date/Time Settings On Shared Hosting Using PHP5’s date_default_timezone_set()

By  on  

One annoyance with putting my customer's site on shared hosting is not being able to control the date and time on the hosting server. Sure, I could simply host with a local company but that's not always the most cost-effective option.

I use a new function to PHP5, the date_default_timezone_set() function, which allows you to set your time zone. The obvious requirement is PHP5. PHP4 is no longer supported so I look forward to seeing more servers hosting PHP5.

date_default_timezone_set('America/Chicago');

Check out the full list of time zones to see which one you should use.

Recent Features

  • By
    CSS vs. JS Animation: Which is Faster?

    How is it possible that JavaScript-based animation has secretly always been as fast — or faster — than CSS transitions? And, how is it possible that Adobe and Google consistently release media-rich mobile sites that rival the performance of native apps? This article serves as a point-by-point...

  • By
    CSS Animations Between Media Queries

    CSS animations are right up there with sliced bread. CSS animations are efficient because they can be hardware accelerated, they require no JavaScript overhead, and they are composed of very little CSS code. Quite often we add CSS transforms to elements via CSS during...

Incredible Demos

  • By
    Six Degrees of Kevin Bacon Using MooTools 1.2

    As you can probably tell, I try to mix some fun in with my MooTools madness but I also try to make my examples as practical as possible. Well...this may not be one of those times. I love movies and useless movie trivia so naturally I'm...

  • By
    Create a Download Package Using MooTools Moousture

    Zohaib Sibt-e-Hassan recently released a great mouse gestures library for MooTools called Moousture. Moousture allows you to trigger functionality by moving your mouse in specified custom patterns. Too illustrate Moousture's value, I've created an image download builder using Mooustures and PHP. The XHTML We provide...

Discussion

  1. Steve

    Learned this the hard way. Hey – worked in 4.x?? Wot?? Since in live where there is no daylight savings time ever, real fubar…

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!