I need to send variables using get method, but the date format should be "dd-monthName-YYYY" just like "02-February-2015" for example.
Can it be done using HTML5 type="date"?
If it can't, then how can i do that?
I need to send variables using get method, but the date format should be "dd-monthName-YYYY" just like "02-February-2015" for example.
Can it be done using HTML5 type="date"?
If it can't, then how can i do that?
You can do it so:
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<input id="datefield" type="date" />
<script>
var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" ];
$("#datefield").change(function () {
var val = $(this).val();
console.log(val);
var d = new Date(val);
console.log(d.getDate() + '-' + monthNames[d.getMonth()] + '-' + d.getFullYear());
});
</script>
</html>
Result:
2015-02-02
2-February-2015