By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,818 Members | 2,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,818 IT Pros & Developers. It's quick & easy.

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

P: 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
Share this Question
Share on Google+
3 Replies


rnd me
Expert 100+
P: 427
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

P: 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

P: 1
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.