var dt_now = '2-22-2013';//mm-dd-yyyy, this is dynamic in actual code
dt_now = dt_now.split("-");
dt_now = addZero(dt_now[2])+'-'+addZero(dt_now[0])+'-'+addZero(dt_now[1]);
dt_now = new Date(dt_now);
I am using the above code to convert a user defined text to actual date for use in rest of my code. it seems to work ok for me but on another system which is situated in a different timezone(my time -12 hours), the date comes out as February 21st
instead of Feb 22nd
, that is, it is running one day behind the expected date. I have no idea how to fix this or what the error might be. Any suggestions?