Answers for "date() to string php"

PHP
2

Datetime to string php

<?php
$date = new DateTime('2000-01-01');
echo $date->format('Y-m-d H:i:s');
?>
Posted by: Guest on March-30-2020
1

Convert DateTime to String in PHP

phpCopy$theDate    = new DateTime('2020-03-08');
echo $stringDate = $theDate->format('Y-m-d H:i:s');

//output: 2020-03-08 00:00:00
Posted by: Guest on April-23-2021

Browse Popular Code Answers by Language