When developing more complex PHP sites, especially forums, discussion boards and blogs where date and time functions are important, you’ll regularly encounter situations where you need to display and manipulate values based around the current date and time. PHP includes a range of functions which can help you to easily format and adjust your date and time displays to suit your needs. In this tutorial, we’ll look at some easy ways to display calendar information for your visitors.
Dates can be hard to work with in PHP, here we learn you the simple way of getting yesterdays date (and other dates relative to today)
This tutorial walks you through how to use a few simple functions - strotime(), date(), and rand() - to find a random date in PHP. The end result is a simple one-line command, which you can place in a function and re-use in your own scripts.
Using the Timezone class to automatically deduce the timezone's GMT offset and then modify the date accordingly.
I must admit that I was going to write you a simple timezone script and then tell you how easy it was. However, I came across some handy timezone_* functions and things got a little more difficult but a lot more practical. This script will allow you to display the time in any timezone you wish, without any ifs, buts or maybes along the way.
If you want to impose restrictions on age when people visit your website, or sign up, you'll need to calculate a user's age through a form - since web servers aren't psychic - yet.
Discusses the uses of the date function, showing examples of how to implement parameters, how to literally process characters within it, and more. Concludes with a list of most date function parameters, descriptions of what they output and examples.
This is a simple snippet of code that will return an array of days between two dates.
Ok, so how do you format dates in PHP so it outputs the date format you want? Well thanks to PHP’s date() and strtotime() function, we can do all that!
In this tutorial I will show you how to create a calendar script in PHP. We will create a simple but good looking - easy customizable via CSS - calendar table.
With PHP's date function you format timestamps, so they are more human readable.
The following tutorial will teach you how to display the current time, formating PHP's timestamp, and show you all the various date arguments for reference purposes.
Help us out! More and more tutorials are submitted to Good-Tutorials each day. We could use your help with finding good tutorials.
Mind lending a hand?