hey i need to change the format of inserting the date value into the date object, someone know how can i do this ? i need to enter this format : DD/MM/YYYYY hh:mm (beside : MM/DD/YYYY hh:mm) i was try this : date=new Date("30/10/2007 11:11"); but its not working... thanks !
try using this: var date = new Date(); var formattedDate = ""; formattedDate = (date.getDate() < 10 )? "0" + date.getDate() : date.getDate(); formattedDate += "/"; formattedDate += (date.getMonth() < 10)? "0" + (date.getMonth()+1) : date.getMonth()+1; formattedDate += "/"; if ( date.getYear() <= 99) { formatedDate += "19"+date.getYear(); } if ( date.getYear() > 99 && date.getYear() < 2000 ){ formattedDate += new String(date.getYear() + 1900); } formattedDate += " " + (date.getHour() < 10)? "0" + date.getHour() : date.getHour(); formattedDate += ":" + (date.getMinutes() < 10)? "0" + date.getMinutes() : date.getMinutes(); Code (markup): I haven't tested it, so there will probably be some errors