Prashanth
Prashanth

Reputation: 21

Displaying date format

I have used date picker and stored it into Mongo collection. I am trying to display it in the format of dd/mm/yyyy. But I want weekday of the date (i:e: MON, TUE, etc), date and month (in words like JAN, FEB, etc).

How can we do that?

Upvotes: 0

Views: 76

Answers (2)

Suresh Prajapati
Suresh Prajapati

Reputation: 21

Here is the code for date

  <?php echo "date:".date("D/M/yyyy",strtotime($yourdate)); ?>

Upvotes: 0

Nikhil Ghuse
Nikhil Ghuse

Reputation: 1288

This might help you...

   function isDate_DD_MMM_YYYY(inputString) {
   var rxDatePattern = /^(\d{1,2})(\/|-)(?:(\d{1,2})|(jan)|(feb)|(mar)|(apr)|(may)|(jun)|(jul)|(aug)|(sep)|(oct)|(nov)|(dec))(\/|-)(\d{4})$/i;
   var dateParts = (inputString.value).match(rxDatePattern);
     if (dateParts != null)
       return true;
     else
       return false;
    }

Upvotes: 1

Related Questions