Apr 02, 2009
A PHP Tip - Show the Current Time with Daylight Savings Time Support!
If you've been keeping up with the latest technology these days, you should know that the programming language, PHP, is one the widely used web-based languages today. With PHP, it offers so many features, it makes it so easy to use. But the thing is, PHP cannot tell whether it is Daylight Savings Time (DST), that is, if you're in the USA. This can be a huge program for lots of people. There's no feature (or function for the programmers out there) that can control this. But there is a way to fix this that'll display the correct time.
I know other developers, like myself, are wanting to know how to do this. I've had to learn how to do this by myself, and I will share it with you.
Now this might be confusing at first, but I'll help explain it to you (read the comments in the code for more help).
Now there's probably a million ways you can do this, but this is the way I did it. I hope this will help someone out who is needing to do the same. All you need to do now after your done is show "$Current_Time" somewhere!
Yes, it takes 123 lines of code (really 16 lines without the comments) in order to display the time! No one never said coding was easy, but I hope this makes it easier for you!
You can download thescript from this file location:
PHP Time File
Stalk me on social media! Any other way would just be creepy…
Follow me: