|
-
Aug 25th, 2012, 11:33 PM
#5
Hyperactive Member
Re: Error in Inserting the Date
 Originally Posted by jmcilhinney
That's not correct. The DateTimePicker can display any format you want but the format that it displays is irrelevant when it comes to using the data. The most important property of the DateTimePicker is Value, which is type DateTime. You should almost never be using the Text property. Because the Value property is a DateTime, format is completely irrelevant. A DateTime is a binary representation of a date and time, not text. Format is only relevant when converting to or from text. If there's no text then there's no format.
In the original code, the String from the TextBox is being converted to a DateTime first and then that is being converted back to a String. That's wring on two counts. You should be using a DateTimePicker as suggested and getting the DateTimne from it and inserting that. DO NOT convert anything that is not text into text.
Thanks for the clarification Jm. I always get a long date value when i'm using date time picker so i think it will always return long date. But thanks again for that information.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|