Sathish Sathish - 6 months ago 38
PHP Question

how to add hypen in date (without delimiters)

I've date and time values without delimiters like,

$date = "20150206";
$time = "011526";

How to do I convert it to date and time?

Answer Source

you can use simple date function for this purpose

<?php echo date("Y-d-m",strtotime($date)); ?>
<?php echo date("h:i:s",strtotime($time)); ?>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download