Get the Only Date part from DateTime SQL

Get the only date from date time in database

 

Real Datetime shows like – yyyy-mm-dd hh:mm:ss

And Now you can break and get the part of the date, time as per your requirement.

$dd = substr($date, 8,2);

$mm = substr($date, 5,2);
$yyyy = substr($date, 0,4);
$newdate = “$dd-$mm-$yyyy”;

And you can show your result anywhere on your web page like –

newdate = dd-mm-yyyy

Published by Sushant Sharma

Technologist. Software Developer. Tech Analyst ।।।

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Design a site like this with WordPress.com
Get started