Loading ...

datetime-format-in-asp.net | CodeAsp.Net

DateTime Format in ASP.NET

4.82 
 /5
4.82 (1votes)

Date and Time is almost used in all application.Here we discuss about the date time format in asp.net.

we can set datetime format following are some formats.

 

d -     day of the month, like 2
dd -   day of month ,like 02 it leads 0
ddd -  first 3 character of the name of the week day, like Mon
ddd -  Full name of the week day, like Monday
M -     Month without leading 0, like 2
MM -   Month with lading 0, like 02
MMM - first 3 character of month name ,like Jan
MMMM- full name of month ,like January
yy -      it shows year like 09
yyyy -  it show full year, like 2009
h -        it show hour like 2 it does't contains leading 0
hh -      it contains leading 0 ,like 03
m -       it shows minutes ,like 3
mm -    it shows,like 03
s -        second without leading 0, like 3
ss -      second with leading 0,like 03


use above format some examples are given below.

Pattern Display format

M/d/yyyy                                  2/3/2008
MM/dd/yyyy                             02/03/2008
MMM/ddd/yy                              Jan/Mon/08
MMMM/dddd/yyyy                     January/Monday/2008
MMMM,dddd,yyyy                       January,Monday,2008,
MMMM,dddd dd,yyyy                            Monday,January 03,2008
MMMM,dddd,yyyy h:mm tt         January,Monday,2008 1:34 PM
MMMM,dddd,yyyy h:mm:ss tt     January,Monday,2008 1:34:15 PM
 

Comments (3)

   
Shaitender
Very Helpful BLOGENTRY!!!
2/26/2009
 · 
by
   
Anonymous
tnx its very useful
5/12/2009
 · 
by
   
Joaking
Joaking
Of course... Indeed...
9/10/2010
 · 
by
  • :*
  • :*
  • :
 *

Top Posts