by webmaster on Fri Feb 15, 2008 9:20 am
There are two easy ways for this. The first one is to save a cookie on the users computer with the setting for that user. The downside is that if he/she clears all cookies, the settings are back to default.
Another way is to save that user to a database with his/her prefered setting. You can save the IP and then set how the clock should look like for that IP. The downside is that many people have dynamic IPs.
I got an idea while writing this, I don't know how many countries that uses the different hour settings. But you could get a geoIP-dtabase, which checks which country the user are from, if they are from the US, it will display a 12 hour clock, if they are from europe, it will display a 24 hour clock. This is just for the "default" setting, you can still use one of the mentioned alternatives above for the customization.
I recommend the first one with cookies by the way!