Reputation: 10575
How to change the Date format that we get from text field "16-JUL-2010" to 20100716 using php or using jquery
Upvotes: 0
Views: 199
Reputation: 44949
In javascript you'd be best off using the Date.js library
<script type="text/javascript" src="http://www.datejs.com/build/date.js"></script>
<script type="text/javascript">
d = Date.parse("16-JUL-2010")
d.toString('yyyyMMdd');
</script>
Upvotes: 0
Reputation: 8382
$date = DateTime::createFromFormat('d-M-y', $_GET['date']);
echo $date->format('Ymd');
Upvotes: 1