TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
karthika pommudu
NA
321
34.6k
y-d-m date format convert in php
Apr 14 2020 11:21 PM
Here the code,
$date = '03/17/2020 - 04/15/2020';
$pieces = explode("-", $date);
$date11= $pieces[0]; // piece1
$date12= $pieces[1]; // piece2
$date1 = str_replace('/', '-', $date11);
$DATE1 = date('Y-d-m', strtotime($date1));
$date2 = str_replace('/', '-', $date12);
$DATE2= date("Y-m-d", strtotime(preg_replace('/[^A-Za-z0-9\-]/', '',$date2)));
echo $DATE1; //2020-03-17
echo $DATE2;//1970-01-01
Output: $DATE1 : 2020-03-17
$DATE2: 1970-01-01
Please advice.
Reply
Answers (
7
)
what best debug tool i can use for debugging php 7 laravel
PHP Fatal error: Out of memory