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 :: how to add recaptcha to woocommerce register php 
Php :: laravel get current action name 
Php :: append to collection laravel 
Php :: php get start of today 
Php :: Format and show date PHP 
Php :: php random string 
Php :: send mail test from laravel 
Php :: wordpress hook add javascript 
Php :: Type error: Argument 1 passed to IlluminateAuthEloquentUserProvider::validateCredentials() 
Php :: php append to csv 
Php :: php var exists 
Php :: php check if file exists 
Php :: how to save file in storage folder in laravel 
Php :: php imap install 
Php :: add pagination to wordpress 
Php :: check value falls between in two range in php 
Php :: PHP Simple HTML DOM 
Php :: PHP get_url 
Php :: add blade in blade laravel 
Php :: How to get a substring between two strings in PHP? 
Php :: Delete an array in multidimensional array php 
Php :: fetch value from json link in php 
Php :: tl to usd 
Php :: add log in laravel 8 
Php :: php rsa encryption 
Php :: only display part of string php 
Php :: laravel sail publish 
Php :: mac address php 
Php :: Http request with bearer token Laravel 
Php :: laravel asset 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =