Home > DeveloperSection > Forums > join two strings into a date time format asp classic
lois waisbrooker
lois waisbrooker

Total Post:70

Posted on    June-20-2013 2:08 AM

 VB Script VB Script 

 1 Reply(s)
 1088  View(s)
Rate this:
Hi Expert,

I have two variables X and Y. X has a date as a string(12-Jun-2013) and Y has a time (12:46 pm) I need to put these two together into a date time format before inserting in into a database. Does anyone know what function I need to use to do this?

Thanks in advance for any recommendations or solutions.

Sumit Kesarwani

Total Post:378

Posted on    June-20-2013 6:54 AM

Hi Lois,

Append your two string, with a space, and use the CDate function to convert the whole thing to a date. So: CDate("12-Jun-2013 12:46 pm") will return the date-time value.

Don't want to miss updates? Please click the below button!

Follow MindStick