Last post Aug 21, 2017 04:25 AM by Eric Du
Aug 18, 2017 07:23 AM|wibowowiwit|LINK
how to convert string to dateTime ?
this is my code :
dim request_time as string
sql = "SELECT CONVERT(VARCHAR(10), request_time, 103) + ' ' + CONVERT(VARCHAR(8), request_time, 14) AS request_time
request_time = RsSql("request_time")
the request_time value is = "18/08/2017 15:00:20"
i want convert request_time from string to dateTime like this "18/08/2017 15:00:20" ?
please suggest me how ?
Thank & Regards.
Aug 18, 2017 08:30 AM|PatriceSc|LINK
A DateTime value doesn't have any particular format ie the 18/08/2017 15:00:20 as a particular point in time will be always stored the same way everywhere. So converting this datetime to a string to convert it back to a "formatted" datetime doesn't really
It is when the value is shown that it needs to be converted to a string (even implicitly when doing a SELECT inside SQL Server Management Studio) and it can show a different string depending on the country convention used for this conversion.
For now I would say:
- don't convert a date to a string on the SQL Server side. Just get the actual datetime value (you'll be able to test, compare, do calculations etc....)
- this datetime value will be converted to a string just for showing this value to the user. By default it uses the current language settings for your web app and so you can use whatever country convention best fit your needs. See
Or elaborate a bit on the problem you are trying to solve if I misunderstood.
Aug 21, 2017 04:25 AM|Eric Du|LINK
According to your description, I think if you want to convert date string to datetime, please check the following sample:
How to: Convert a String to a DateTime (C# Programming Guide):
Also I hope you could tell us why you want to convert or what your needs is?