does datagridview cell can have datetime pattern (" / / ")
or (" . . "), that the user can entering only between
two slash or two dots in datagridview cell ?
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Soft CornerRank #1,221 · 1.5K reputationPosted Jan 9, 2011, 8:22 PM EST
There are different patterns for gridview,
for e.g :
we need to include DataFormatString = "{0:d}" for the BoundColumn to display a short date.
The following table shows some date format strings that can be used to format date in GridView columns,
Format Pattern
Name
Example
d
Short date
11/8/2008
D
Long date
Sunday, August 11, 2008
t
Short time
3:32 PM
T
Long time
3:32:00 PM
f
Full date/time
(short time)
Sunday, August 11, 2008 3:32 PM
F
Full date/time
(long time)
Sunday, August 11, 2008 3:32:00 PM
g
General date/time
(short time)
8/11/2008 3:32 PM
G
General date/time
(long time)
8/11/2008 3:32:00 PM
m or M
Month day
August 11
r or R
RFC 1123
Sun, 11 Aug 2008 8:32:00 GMT
s
Sortable date/time
2008-08-11T15:32:00
u
Universable sortable date/time
2008-08-11 15:32:00z
U
Universable sortable date/time
Sunday, August 11, 2008 11:32:00 PM
y or Y
Year month
August, 2008
Vishwa Raj5 reputationPosted Feb 1, 2011, 1:15 AM EST
Suthish NairRank #92 · 22.8K reputationPosted Feb 1, 2011, 8:36 AM EST
refer articles:
MaskedTextBox in VB.NET
Masked TextBox Control
Suthish NairRank #92 · 22.8K reputationPosted Feb 4, 2011, 9:18 AM EST
So other members can easily find the answers.