The following is some lists of the date and time characters to use between the round brackets of date. They are all case sensitive. The date function syntax is this, remember:
date( date_characters_here )
The script from the previous page was this:
$today = date('d-m-y');
The first list is for the day of the week characters. Try them out on your script above.
Day of the week Characters (opens in a new window)
You'll also need the year characters:
Year Characters (opens in a new window)
To add the Time, use the following characters:
Time Characters (opens in a new window)
Here's some other Characters that may come in handy:
Other Characters (opens in a new window)
That's quite a lot of characters! Mostly, you'll be dipping in and out to find the one you need. Here's a few examples of the way you can use the above. Try out the following scripts to see how they work.
Example 1 (prints out something like Monday 7th January 2017)
$today = date('l jS F Y');
Example 2 (prints out something like "It's week 4 of 2017")
$today = date('W');
$year = date('Y');
print "It's week " . $today . " of " . $year;
Example 3 (prints out something like "11:25:44 am")
$time = date('h:i:s a');
Example 4 (prints out something like "23:28 GMT Standard Time")
$time = date('G:i T');
In the next part, we'll see another useful date/time function when we look at getdate().