By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,490 Members | 1,417 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,490 IT Pros & Developers. It's quick & easy.

Changing a Date Time Value

P: n/a
Changing a Date Time Value

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

I want the date format to be “dd-MMM-YYYY HH:MM:SS” e.g. “31-Dec-2006

I think I need to use the CDate function but I cant seem to get it to work.
Please help!

Mar 17 '06 #1
Share this Question
Share on Google+
2 Replies

P: n/a

I can start a long message. However mostly is the only problem that the Text
property is taken from the DateTime picker, while it has to be the Value
property (than it is already in the datetime format).

If this not help, than reply, althouhg I hope it helps of course.

Mar 17 '06 #2

P: n/a
Hi bh,

If you have a DateTime object, you can always format the output any way
you want.

DateTime dt = new DateTime(2006, 12, 31, 23, 59, 59);
MessageBox.Show(dt.ToString("dd-MMM-yyyy HH:mm:ss"));

(Note, small y m s for year, minutes, seconds)

On Fri, 17 Mar 2006 12:09:28 +0100, bh <>

Happy Coding!
Morten Wennevik [C# MVP]
Mar 17 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.