Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php convert string to date

$time = strtotime('10/16/2003');

$newformat = date('Y-m-d',$time);

echo $newformat;
// 2003-10-16
Comment

php string to date

$s = '06/10/2011 19:00:02';
$date = strtotime($s);
echo date('d/M/Y H:i:s', $date);
The above one is the one of the example of converting a string to date.
echo $s ->format('Y-m-d');
The above one is another method 
Comment

string to datetime php

$s = '06/10/2011 19:00:02';
$date = strtotime($s);
echo date('d/M/Y H:i:s', $date);
Comment

convert string to date php

$s = '08/11/2010 19:37:02';
$date = strtotime($s);
echo date('Y-m-d H:i:s', $date);
Comment

convert date php

$var = '21/05/2012';
$date = str_replace('/', '-', $var);
echo date('Y-m-d', strtotime($date))
Comment

Convert String to Date and Date-Time in PHP

phpCopy$oldDate = strtotime('03/08/2020');

$newDate = date('Y-m-d',$time);

echo $newDate;
//output: 2020-03-08
Comment

Convert String to Date and Date-Time in PHP

phpCopyecho $dateNew = DateTime::createFromFormat('m-d-Y', '03-08-2020')->format('Y/m/d');
//output: 2020/03/08
Comment

Convert String to Date and Date-Time in PHP

phpCopyecho $dateNew = date_create_from_format("m-d-Y", "03-08-2020")->format("Y-m-d");
//output: 2020/03/08
Comment

php string to date

$s = '06/10/2011 19:00:02';$date = strtotime($s);echo date('d/M/Y H:i:s', $date); The above one is the one of the example of converting a string to date. echo $s ->format('Y-m-d'); The above one is another method 
Comment

PREVIOUS NEXT
Code Example
Php :: how to set up alert messages in laravel 8 
Php :: laravel use controller function in another controller 
Php :: clear session in laravel 
Php :: how to remove duplicate data in php 
Php :: php multiplication 
Php :: php check year and month is between two dates 
Php :: How do you set a variable to an integer? in php 
Php :: laravel validation check value should be one of in array 
Php :: call api with php 
Php :: PHP array_merge() Function 
Php :: php trim 
Php :: php round nearest half 
Php :: The "AppEntity entity has a repositoryClass set to but this is not a valid class. 
Php :: Displaying Custom Navigation Menus in WordPress Themes 
Php :: php validate credit card expiration date 
Php :: yii1 refresh cache schema 
Php :: laravel 9 route group 
Php :: destruct php 
Php :: php while loop 
Php :: php list all files in directory 
Php :: transforming string to integer in php 
Php :: set cookie on button click php or js 
Php :: laravel eloquent get one column value 
Php :: how to get the size of an uploaded file in laravel 
Php :: add action hook 
Php :: php get duplicate keys in array without using inbuilt function 
Php :: return back laravel controller 
Php :: laravel rate limit 
Php :: php into javascript 
Php :: yii2 migration --fields foreign 
ADD CONTENT
Topic
Content
Source link
Name
6+2 =