How to format date like Day, Month date, Year time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vertigo262
    New Member
    • Jul 2007
    • 62

    How to format date like Day, Month date, Year time

    this one should be pretty simple. All I want to do is formatdate in this format.

    Saturday, September 25, 2010 12:00 am

    Code:
    function getRecordInfo(oLink, iIndex) {
    		        
    		        var Subject = GridBulletins.Rows[iIndex].Cells[0].Value;
    		        var Bulletin = GridBulletins.Rows[iIndex].Cells[1].Value;
    		        var DateStamp = GridBulletins.Rows[iIndex].Cells[2].Value;
    		      
                 
    
     var sNewHtml = "<div style='text-align: left; padding: 3px;'>";
                     sNewHtml += "<b>Subject</b> " + Subject + "<br><br>";
                     sNewHtml += "<b>Bulletin</b> " + Bulletin + "<br><br>";
                     sNewHtml += "<b>Date</b> " + DateStamp + "";
    
                     return sNewHtml;
    		    }
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    how does DateStamp look like at the moment?

    Comment

    • vertigo262
      New Member
      • Jul 2007
      • 62

      #3
      like this

      Date: 10/19/2010 1:49:47 PM

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5390

        #4
        you might create a javascript Date object from that like:

        Code:
        var jsDate = new Date('10/19/2010 1:49:47 PM');
        and then use the Date's methods to create the desired output. You could even use RegExp or String-Methods to parse your date-string and modify it ...

        if you really want to display full day/month-names then you will probably have to create some mappings where 'Tue' maps to 'tuesday' or 'Oct' to 'October' or similar mappings - depending on the method you would choose to process the data.
        Last edited by gits; Oct 23 '10, 10:28 AM.

        Comment

        Working...