Forum Discussion

afolks's avatar
12 years ago

Convert to Regional Date format using DateTimeToFormatStr

According to the documentation I should be able to convert a date to my system's regional format but it does not seem to work.



This is my code (JScript):




sDate is, Mon Jun 21 10:27:05 EDT 2004 


 


function convertDateToRegionalDateFormat(sDate)


{


    // Create date time element in mm/dd/yyyy format


       var stDate = sDate.split(' ')[0];


    // Create time element in hh:mm:ss format


       var stTime = sDate.split(' ')[1];


     


    // Converting it into a date time element


       var dDate = aqConvert.StrToDateTime(stDate + " " + stTime); 


   


    // Now put it all together and build the date and time of the users local


       var dateAndTime = aqConvert.DateTimeToFormatStr(dDate, "%x %X");


   


   Log.Message("dDate is, " + dDate + " and dateAndTime is, " + dateAndTime);


}


 





What am I missing?'

My region should convert it to dd/mm/yyyy but it always comes back as mm/dd/yyyy