0

Here is my jquery code

var data='<?php echo  date('D M d Y H:i:s').""; ?>';
var someDate = new Date(data);
var dd = someDate.getDate();
var mm = someDate.getMonth() + 1;
var y = someDate.getFullYear();
var someFormattedDate = mm + '/'+ dd + '/'+ y;
$("#est_date").html(someFormattedDate); 

The output of the above code is

11/18/2014

But i need to display the output in the following date format

Nov 18, 2014

How is it possible in the jquery? Pls tell me any one knows?

adeneo
  • 312,895
  • 29
  • 395
  • 388
NitheesBavesh
  • 163
  • 1
  • 4
  • 18

3 Answers3

2

Why on earth wouldn't you just echo the date in the right format from PHP, which actually have an excellent date library

$("#est_date").html("<?php echo date('M d, Y'); ?>"); 
adeneo
  • 312,895
  • 29
  • 395
  • 388
1

If you wants to print any date format within using javasscript only then you can refer below given link which have many different date formats.

Print Any Date Format In JAVASCRIPT

Lalit Sharma
  • 555
  • 3
  • 12
0
<?php $originalDate = date('D M d Y H:i:s');
$newDate = date("M d ,Y", strtotime($originalDate));
?>

<script type="text/javascript" >
$( document ).ready(function() {
$("#est_date").html('<?php echo  $newDate; ?>'); 
});
</script>
chikara
  • 11
  • 1