471,887 Members | 1,463 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,887 software developers and data experts.

date format conversion

how to convert dd/mmm/yyyy to dd/mm/yyyy using java script
Apr 26 '07 #1
3 1675
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

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.