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

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 :: homebrew switch php version 
Php :: php default timezone 
Php :: Check duplicate email in laravel using jQuery validation 
Php :: group routes in laravel 
Php :: how to limit excerpt length in wordpress 
Php :: how to add properties to the request object 
Php :: sort array by key value in php 
Php :: how to hide .php extension using .htaccess 
Php :: php fpm status check 
Php :: phpstan ignore 
Php :: laravel request validation boolean 
Php :: phpmailer with laravel 
Php :: how to escape html tags in php 
Php :: laravel dropIndex 
Php :: current date in carbon 
Php :: php 301 redirect 
Php :: error first laravel 
Php :: wp_query limit 1 
Php :: php header redirect same page 
Php :: enable shortcodes in text widgets 
Php :: convert 1 digit to five digits laravel 
Php :: qual é a melhor linguagem de programação para iniciantes 
Php :: wordpress embed shortcode in php 
Php :: php datetime to mysql 
Php :: how login one user with id in laravel 
Php :: laravel session put method 
Php :: PHP strlen — Get string length 
Php :: Laravel Drop All Tables & Migrate 
Php :: .htaccess for laravel in hostinger 
Php :: get today date in php 
ADD CONTENT
Topic
Content
Source link
Name
6+4 =