This page is no longer updated

We've left it here for reference. Find Out More.


Standard Dates and Date Manipulation.

Using a consistent date format throughout your website is a pretty easy thing to do - you just write it into your code.

That however isn't very forward thinking. What if, in the future, you want to change that date format? What if you want to pass the date through to a procedure? What if you're getting a date from an external source? What if you want to reuse content on a site which has a different standard date format.

After years of hardcoding dates into things, I decided that personally I needed to do things differently. Instead of using a date of the format "March 20, 1999", I decided it would be much more sensible to specify the date in a more adapatable format of "1999-03-20". That way, I could change my mind in the future and output it as "20 March 1999" if I wanted.

Why choose "1999-03-20"? Funnily enough, this is the date format which Hitop uses as standard!

Obviously I needed a piece of code to manipulate my date into something more readable...

top^ | next>

Planet Bods NetworkSites in the network