I have a form with a date time picker or it and a button. When the button is
pressed it passes the date/time into a stored procedure that queries an SQL
database. Because the date time format is different I am receiving an error.
I want the date format to be “dd-MMM-YYYY HH:MM:SS” e.g. “31-Dec-2006
23:59:59”
I think I need to use the CDate function but I cant seem to get it to work.
Please help!
Michael Nemtsev - 17 Mar 2006 22:22 GMT
Hello bh,
Use DateTime.Now.ToString("dd-MMM-yyyy HH:mm:ss");
b> I have a form with a date time picker or it and a button. When the
b> button is pressed it passes the date/time into a stored procedure
b> that queries an SQL database. Because the date time format is
b> different I am receiving an error.
b>
b> I want the date format to be “dd-MMM-YYYY HH:MM:SS” e.g. “31-Dec-2006
b> 23:59:59”
b>
b> I think I need to use the CDate function but I cant seem to get it to
b> work. Please help!
b>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour
"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch
Kolbis Guy - 26 Mar 2006 23:58 GMT
Hi bh,
In my opinion you should not be using date and time in the database, but a
long variable that represents the number of ticks in since a certain date.
The reason for that is the windows current culture.
Regards,
> I have a form with a date time picker or it and a button. When the button is
> pressed it passes the date/time into a stored procedure that queries an SQL
[quoted text clipped - 5 lines]
> I think I need to use the CDate function but I cant seem to get it to work.
> Please help!