1. How do i return or format "01/01/2012" in stored procedure only"?
2. How do i
return or format "Jan 1, 2012" in stored procedure only"?
3. How do i
return or format "12:00 AM in stored procedure only"?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
David SmithPosted Aug 27, 2012, 5:14 AM
At the moment , I am doing a simple query below to
Select Firstname, LastName, CreatedDateTime
From ExampleTable
Akkiraju IvaturiPosted Aug 27, 2012, 3:06 AM
SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 3), 4, 5) AS [MM/YY]
SELECT SUBSTRING(CONVERT(VARCHAR(8), GETDATE(), 5), 4, 5) AS [MM-YY]
SELECT SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 3, 5) AS [YY-MM]
Akkiraju IvaturiPosted Aug 27, 2012, 3:06 AM
HH:MIAM (or PM)
milliseconds
(with milliseconds)
mohanad kayaliPosted Aug 27, 2012, 1:45 AM
SELECT
GETDATE() AS UnconvertedDateTime,
CAST(GETDATE() AS nvarchar(30)) AS UsingCast,
CONVERT(nvarchar(30), GETDATE(), 101) AS UsingConvertTo_ISO8601 ;
GO