Im having a problem formatting a datetime field in ASP Classic. The format I need is yyyy-mm-dd hh:mm:ss this is my code so far:
changeToDate = cdate(Request.Form("datepicker")&" "&Request.Form("timepicker"))
dateTime = DatePart("d", changeToDate)&"-"&DatePart("m", changeToDate)&_
"-"&DatePart("yyyy", changeToDate)&" "&DatePart("hh", changeToDate)&":"&_
DatePart("mi", changeToDate)&":00"
but this gives me a invalid procedure call datepart exception. I'm kind of stuck on this.
Not sure if it matters or not but I am doing this so that I can insert the datetime into the database. when i just use the cdate function I get the following error:Conversion failed when converting date and/or time from character string. This is what my query looks like with just the cdate function called:
INSERT INTO mytable(Client ,Campaign ,Location ,CardCode ,Created ,Message ,Rating ,Info ,mobile ,DataMessage ) VALUES (117,227,1487,'NJPNUYX','10/07/2013 9:10:00 a.m.','NJPNUYX 4 safda',4,'safda','0215833650','0223232345')