[RobDog's Friend]
This site created by RobDog711 - (c) 2010
  
KB Article
Title:
ASP.NET Format String Reference
Texts
Description:
I often have to display dates and I will normally format the displayed date to be more "user friendly". Below are some of the common string format codes I use. See also the Additional Resources section for more detailed information regarding formatting data.
Code / Script:
d = Day of the month as a number from 1 through 31
dd = Day of the month as a number from 01 through 31, with leading zero.
ddd = Abbreviated name of the day of the week (Mon, Tues, Wed etc)
dddd = Represents the full name of the day of the week (Monday, Tuesday etc)
h = 12-hour clock hour (e.g. 7)
hh = 12-hour clock, with a leading 0 (e.g. 07)
H = 24-hour clock hour (e.g. 19)
HH = 24-hour clock hour, with a leading 0 (e.g. 19)
m = Minutes
mm = Minutes with a leading zero
M = Month number
MM = Month number with leading zero
MMM = Abbreviated Month Name (e.g. Dec)
MMMM = Full month name (e.g. December)
s = Seconds
ss = Seconds with leading zero
t = Abbreviated AM / PM (e.g. A or P)
tt = AM / PM (e.g. AM or PM)
y = Year, no leading zero (e.g. 2001 would be 1)
yy = Year, leadin zero (e.g. 2001 would be 01)
yyy = Year, (e.g. 2001 would be 2001)
yyyy = Year, (e.g. 2001 would be 2001)
K = Represents the time zone information of a date and time value (e.g. +05:00)

[Special Patterns]
D = dddd, dd MMMM yyyy (e.g. Tuesday, 22 August 2009)
F = dddd, dd MMMM yyyy HH:mm:ss (e.g. Tuesday, 22 August 2006 06:30:07)
G = MM/dd/yyyy HH:mm:ss (e.g. 08/22/2006 06:30:07)
M = MMMM dd (e.g. August 22)
Misc
Additional resources:
Views: 20 - Posted: Jun 25th, 2010 (Fri) - Modified: Jul 7th, 2010 (Wed)
Category: ASP / VBScript - Topic: Web Contruction
Author: RobDog
No associations
 
Comments: 0
 
No comments have yet been posted. Login to post a comment.
 
© 2006-2010 RobDog711 :: Terms of Use
IP: 38.107.191.105 - Res: - Built: 0.395 sec