469,319 Members | 2,223 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

date format conversion

how to convert dd/mmm/yyyy to dd/mm/yyyy using java script
Apr 26 '07 #1
3 1624
acoder
16,027 Expert Mod 8TB
Use the Date() object. Set the day, month and year using the set*** methods. To set the month, use an array with the named months and the index month that matches will be the numbered month.
Jan 30 '08 #2
how to convert dd/mmm/yyyy to dd/mm/yyyy using java script
Expand|Select|Wrap|Line Numbers
  1. var today=new Date();
  2. var t=today.toString().split('U',2);
  3.  var month=t[0].split(' ',4);
  4. var mon=today.getMonth()+1;
  5.  
  6. if(format==dd/mm/yyyy)
  7. {
  8. document.getElementById(id).innerHTML = Day+ " "+ (mon);
  9. }
Feb 5 '08 #3
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. var today=new Date();
  2. var t=today.toString().split('U',2);
  3.  var month=t[0].split(' ',4);
  4. var mon=today.getMonth()+1;
  5.  
  6. if(format==dd/mm/yyyy)
  7. {
  8. document.getElementById(id).innerHTML = Day+ " "+ (mon);
  9. }
This code wouldn't work. Why are you splitting on the letter U?

Ps. please use code tags when posting code. Thanks!
Feb 5 '08 #4

Post your reply

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

Similar topics

3 posts views Thread by praba kar | last post: by
15 posts views Thread by Simon Brooke | last post: by
50 posts views Thread by z. f. | last post: by
1 post views Thread by Franck | last post: by
12 posts views Thread by Assimalyst | last post: by
10 posts views Thread by =?Utf-8?B?TWlrZQ==?= | last post: by
2 posts views Thread by RN1 | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by mdpf | last post: by
reply views Thread by harlem98 | last post: by
reply views Thread by listenups61195 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.