17.2. Dates and Time in PHP
Up to now you have seen how you can work with dates and time in PostgreSQL. In this section we will see how dates and time can be treated when working with PHP's onboard functions.
17.2.1. PHP's Functions
In this section you will be guided through PHP's functions related to time.
17.2.1.1. getdate
One of the most important functions is the getdate function. It returns the current date in an array of values that can be used for further treatment. Let's take a look at an example:
<?php $mydate = getdate(); echo "seconds: ".$mydate['seconds']."<br>"; echo "minutes: ".$mydate['minutes']."<br>"; echo "hours: ".$mydate['hours']."<br>"; echo "mday: ".$mydate['mday']."<br>"; echo "wday: ".$mydate['wday']."<br>"; echo "mon: ...
Get PHP and PostgreSQL: Advanced Web Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.