Answers for "datetime object php"

PHP
3

php datetime create

$date = DateTime::createFromFormat('d-m-Y', '15-12-2020');
Posted by: Guest on February-17-2020
3

datetime php

$dateTime = new \DateTime();
$dateTime->format('Y-m-d H:i:s');
Posted by: Guest on June-15-2020
2

datetime php

# From a date Object:
date_format ( DateTimeInterface $object , string $format )

# From the current time
$dateTime = new \DateTime(); 
// or pass a string or int ->`DateTime($date_time)`
$dateTime->format('y-j-d H:i:s T'); #print ex: 21-2-02 16:00:01 PST

# Or a quick one-liner:
date('g:i A m-d-Y', strtotime($date_time)); #print ex: 2:00 PM 02-02-2021
Posted by: Guest on January-15-2021
-2

date time in php

$today = date("Y-m-d H:i:s");                     // 2001-03-10 17:16:18 (le format DATETIME de MySQL)
Posted by: Guest on August-16-2021

Code answers related to "datetime object php"

Browse Popular Code Answers by Language