August 15, 2012 at 11:22 pm
How do I convert this date '19/10/2011 2:00:00 PM' to a standard datetime value?
August 16, 2012 at 12:46 am
SELECT CONVERT(VARCHAR(10), '2012-08-17 00:00:00.000', 111) AS [YYYY/MM/DD]
August 16, 2012 at 12:49 am
SELECT convert(datetime, '10/19/2011 2:00:00 PM') -- mm/dd/yyyy
August 16, 2012 at 1:25 am
Although a bit dated (no pun intended) there is an interesting article by Robyn Page for various date and time conversions - http://www.simple-talk.com/sql/learn-sql-server/robyn-pages-sql-server-datetime-workbench/.
August 16, 2012 at 1:55 am
BrainDonor (8/16/2012)
Although a bit dated (no pun intended) there is an interesting article by Robyn Page for various date and time conversions - http://www.simple-talk.com/sql/learn-sql-server/robyn-pages-sql-server-datetime-workbench/.
Very good it is too.
SELECT
DateFromString,
DateBackToString = CONVERT(VARCHAR(23),DateFromString,103) -- drops time component
FROM (
SELECT DateFromString = CONVERT(DATETIME,'19/10/2011 2:00:00 PM',103) -- uses time component
) d
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
August 19, 2012 at 7:16 pm
Thanks vijayarani87.s
This simple solution worked perfectly - I just had to include 'set dateformat dmy' before the 'convert'.
Much appreciated,
Peter
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply