Showing posts with label Date. Show all posts
Showing posts with label Date. Show all posts

Monday, March 16, 2009

C#: Control over date formatting, replace ToShortDateString

 

I found that it is more flexible and readable for me to use the ToString formatting for dates

objDate.ToString("MM/dd/yyyy");

than to use this:

objDate.ToShortDateString()

Tuesday, January 20, 2009

Converting Dates in SQL Server

 

image

SELECT 
   GETDATE() AS DefaultFormat,
   CONVERT(nvarchar(30), GETDATE(), 101) AS US,
   CONVERT(nvarchar(30), GETDATE(), 103) AS UK,
   CONVERT(nvarchar(30), GETDATE(), 111) AS Japan,
   CONVERT(nvarchar(30), GETDATE(), 104) AS German,
   CONVERT(nvarchar(30), GETDATE(), 112) AS ISO,
   CONVERT(nvarchar(30), GETDATE(), 109) AS Date_with_Milliseconds
 

image

Source