Reputation:
I am using DateTimePicker
control. When I select date I want date as 20 Feb 2013
, instead I am getting 20-2-2013
or 2/20/2013
.
I tried different functions of DateTimePicker
.
I kept Format
option of DateTimePicker
as Short
.
dtpSaudaDate.value.Date.ToShortDateString();
dtpSaudaDate.value.Date.ToOADate();
None of the function worked. Is there any specific method to get date in that format? [ 28 Feb 2013 ]
Upvotes: 0
Views: 105
Reputation: 845
Have you tried
dtpSaudaDate.value.Date.ToString("dd MMM yyyy");
For more formats:
http://www.dotnetperls.com/datetime-format
Upvotes: 0
Reputation: 236208
Format
property of DateTimePicker
to Custom
CustomFormat
property to dd MMM yyyy
UPDATE (month formatting for DateTime)
M
is a month, from 1 through 12 (2)MM
is a month, from 01 through 12 (02)MMM
is abbreviated name of the month (Feb)MMMM
is full name of the month (February)Upvotes: 3