Question question about Date Time Picker or Month Calendar

rekhtar

Member
Joined
Dec 24, 2008
Messages
9
Programming Experience
Beginner
Dears,

I need to retrieve data from SQL server by date, the date format in SQL like this:

2011-02-21 00:00:00.000

how i can modify the format of Date Time Picker or Month Calendar to be like SQL date Format ??

thanks in advance
 
First up, the dates in SQL Server have no such format. SQL Server stores dates and times as numbers, as do pretty much all databases. They are generally an offset from a particular point in time. Format is only an issue when displaying the data, at which point it must be converted to a string in a specific format. The underlying data is still a number though.

Because format is primarily a display issue, it makes sense that you want to format the date appropriately in your DateTimePicker. Have you looked at the documentation for the DateTimePicker, or even looked in the Properties window? If so then it should be fairly obvious which properties relate to formatting. They would be the ones with "Format" in the name. As for how to specify a particular format, all the information you need can be found in the MSDN documentation:

date time format .net - MSDN Search
 
Back
Top