You should always store dates in SQL server in it's native format - that's US style dates. Yes it's a pain for us UK programmers but, believe me, it keeps life simple.
When you return data from SQL server (datetime type field) into VB.net it will come out in this format
2017-11-21T13:29:09.03Z So this is the date, the time with seconds really very accurately to .03 (milliseconds) and then the Zulu marker.
This unfortunately is too specific to go into a javascript datetime-local control. I got this error:
The specified value "Tue Nov 21 2017 14:29:09 GMT+0100 (W. Europe Standard Time)" does not conform to the required format. The format is "yyyy-MM-ddThh:mm" followed by optional ":ss" or ":ss.SSS".
Which looks pretty similar! But look carefully and the 3rd milliseconds decimal is specified .SSS - wow talk about picky.
Since it's unlikely you need it so precise you can do what I did which is to format the outbound string
CDate(MyDateString).ToString("o")
For more information see Hulvej's answer on this page: https://stackoverflow.com/a/31453408/1521562
Kbytes Home | Privacy Policy | Contact us | Testing Area
© 2004 - 2024 1 Oak Hill Grove Surbiton Surrey KT6 6DS Phone: +44(020) 8123 1321