CodeIgniter Forums

Full Version: Date
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I extract day and month from date in Codeigniter 4?
Quick example:

PHP Code:
$timestamp time();

$date date('Y-m-d'$timestamp);
$fields explode('-'$date);

'Year  = '.$fields[0]."<br>";
'Month = '.$fields[1]."<br>";
'Day   = '.$fields[2]; 

Or you can use the PHP DateTime object.
If you have a CI4 Time object you can simple use the getters (