Rome hotels - Find jobs - Kamala - Secured Loans - Indian television shows news

PDA

View Full Version : Converting ('2007-07-31 00:00:00.000') to dd/mm/yyyy formate


prakash_uj@yahoo.co.ine
Dec 10th 2007, 2:16 am
dear all

i want to convert a string to dateformate

var string=2007-07-31 00:00:00.000

the ouput should be like this 31/7/2007

Can anyone help me to resolve this issue.

Mike H.
Dec 10th 2007, 3:59 am
var dateStr = "2007-07-31 00:00:00.000";

dateStr = dateStr.replace(/(\d{4})-(\d{2})-(\d{2}).+/,"$3/$2/$1")

alert(dateStr);

temp2
Dec 10th 2007, 6:10 am
short code but useful

thank