zod
zod

Reputation: 12417

How can I change PHP date format

A user selects dating like 22-Sep-2010 from jQuery datepicker.

Is there a php function to convert that date to 22/09/2010? Could strtottime or mktime be used?

Upvotes: 1

Views: 225

Answers (2)

Vijin Paulraj
Vijin Paulraj

Reputation: 4618

To convert the date format from dd-mmm-yyyy to dd/mm/yyyy in php,

<?php

$dt='22-Sep-2010';
$dt=date('d/m/Y',strtotime($dt));
echo $dt;

?>

The o/p will be, 22/09/2010

Upvotes: 0

GSto
GSto

Reputation: 42350

$newTime = date('d/M/Y',strtotime($oldTime));

where $oldTime is the value from the date picker.

Upvotes: 6

Related Questions