469,277 Members | 1,937 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

convert format date from "YYYY-mm-dd" to "dd-mm-YYYY"

77
Hello all, asking again
i want to convert format date from "YYYY-mm-dd" to "dd-mm-YYYY"

example from "2008-08-16" become format date like this one "16-08-2008"

is it anyone who has this library??thanks
Jul 16 '08 #1
3 26249
rnd me
427 Expert 256MB
Expand|Select|Wrap|Line Numbers
  1. function convertDate(dateString){
  2. var p = dateString.split(/\D/g)
  3. return [p[2],p[1],p[0] ].join("-")
  4. }
  5.  
  6. convertDate("2001-9-11")//"11-9-2001"
Jul 16 '08 #2
maminx
77
Expand|Select|Wrap|Line Numbers
  1. function convertDate(dateString){
  2. var p = dateString.split(/\D/g)
  3. return [p[2],p[1],p[0] ].join("-")
  4. }
  5.  
  6. convertDate("2001-9-11")//"11-9-2001"

thanks...it works well
Jul 17 '08 #3
following function used to convert one date formate to another

Expand|Select|Wrap|Line Numbers
  1. function FormateDate(oldDate)
  2. {
  3. var newDate=new Date(oldDate.toString().split("-").reverse().join("-"));
  4. return newDate;
  5. }
Jun 28 '14 #4

Post your reply

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

Similar topics

4 posts views Thread by Richard Hollenbeck | 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 CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.