ciao a tutti,
ho un problema con una espressione regolare
in pratica si aspetta una data in questo formato 25-11-2005 mentre io la passo 2005-11-25 e quindi non fà il suo lavoro a dovere come posso risolvere??
Grazie millecodice:function str2dt (str_datetime) { var re_date = /^(\d+)\-(\d+)\-(\d+)/; if (!re_date.exec(str_datetime)) return alert("Invalid Datetime format: "+ str_datetime); return (new Date (RegExp.$3, RegExp.$2-1, RegExp.$1, RegExp.$4, RegExp.$5, RegExp.$6)); } function dt2dtstr (dt_datetime) { return (new String ( dt_datetime.getFullYear()+"-"+(dt_datetime.getMonth()+1)+"-"+dt_datetime.getDate()+" ")); }![]()

Rispondi quotando