String.Format("{0:g}", DateTime.Now);
This outputs the current date and time in the following format: 8/05/2007 11:13 AM
Formats Include
{0:d} : 8/21/2007 (short date)
{0:D} : Tuesday, 21 August 2007 (long Date)
{0:f} : Tuesday, 21 August 2007 11:13 AM (full short)
{0:F} : Tuesday, 21 August 2007 11:13:17 AM (Full long)
{0:g} : 21/08/2007 11:13 AM (general)
{0:G} : 21/08/2007 11:13:17 AM (General long)
{0:m} : 21 August (month day)
{0:o} : 2007-08-21T11:13:17.4687500+10:00 (round trip)
{0:R} : Tue, 21 August 2007 11:13:17 GMT (RFC1123 pattern)
{0:s} : 2007-08-21T11:13:17 (sortable)
{0:t} : 11:13 AM (short time)
{0:T} : 11:13:17 AM (long Time)
{0:u} : 2007-08-21 11:13:17Z (universal)
{0:U} : Tuesday, 21 August 2007 1:13:17 AM (Universal GMT)
{0:Y} : August 2007 (Year month)
{0:dd} - 06 (day)
{0:ddd} - Sat (day abbr)
{0:dddd} - Saturday (day full)
{0:fff} - 692 (second fraction)
{0:gg} - A.D. (era)
{0:hh} - 07 (12 hour)
{0:HH} - 19 (24 hour)
{0:mm} - 21 (minute)
{0:MM} - 01 (month)
{0:MMM} - Jan (month abbr)
{0:MMMM} - January (month full)
{0:ss} - 29 (seconds)
{0:tt} - PM (am/pm)
{0:yy} - 07 (year)
{0:yyyy} -2007 (year full)
{0:zz} -08 (timezone)
{0:zzz} -08:00 (timezone full)
{0:hh:mm:ss} -7:21:29 (separators)
{0:MM/dd/yyyy} -1/06/2007 (separators)
Captions
- Asp.Net (9)
- ASP.Net Tips (1)
- C# (7)
- Computer (1)
- Internet Explorer (5)
- Java Script (11)
- Shortcut Keys (4)
- SQL Programming - Common Mistakes (11)
- Sql Server (22)
- Sql Server Definitions (8)
- Sql Server Test (2)
- SSRS (2)
About Me
- Vasanth.S
- I'm just normal guy who like to travel, addicted to TV and Computer, Playing Computer Games and Watching Movies and many more. Have lot of idea and quote in life
My Blog List
-
-
Pass data from one page to another using post15 years ago