469,603 Members | 2,069 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,603 developers. It's quick & easy.

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

Expand|Select|Wrap|Line Numbers
  1.  
  2. function getRecordInfo(oLink, iIndex) {
  3.  
  4.                 var Subject = GridBulletins.Rows[iIndex].Cells[0].Value;
  5.                 var Bulletin = GridBulletins.Rows[iIndex].Cells[1].Value;
  6.                 var DateStamp = GridBulletins.Rows[iIndex].Cells[2].Value;
  7.  
  8.  
  9.  
  10.  var sNewHtml = "<div style='text-align: left; padding: 3px;'>";
  11.                  sNewHtml += "<b>Subject</b> " + Subject + "<br><br>";
  12.                  sNewHtml += "<b>Bulletin</b> " + Bulletin + "<br><br>";
  13.                  sNewHtml += "<b>Date</b> " + DateStamp + "";
  14.  
  15.                  return sNewHtml;
  16.             }
  17.  
  18.  
Oct 22 '10 #1
3 2716
gits
5,390 Expert Mod 4TB
how does DateStamp look like at the moment?
Oct 22 '10 #2
like this

Date: 10/19/2010 1:49:47 PM
Oct 22 '10 #3
gits
5,390 Expert Mod 4TB
you might create a javascript Date object from that like:

Expand|Select|Wrap|Line Numbers
  1. 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.
Oct 23 '10 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by praba kar | last post: by
4 posts views Thread by peashoe | last post: by
reply views Thread by lsy | last post: by
1 post views Thread by Keith Chadwick | last post: by
1 post views Thread by '[] WiRaN | last post: by
2 posts views Thread by fniles | last post: by
reply views Thread by guiromero | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.