daily pastebin goal
57%
SHARE
TWEET

DateTime Reversed

SQLSoldier Jun 15th, 2017 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Declare @DT varchar(35) = '1:30:21 PM 3/29/2017';
  2.  
  3. Select Cast(Right(@DT, Len(@DT) - Charindex(' ', @DT, Charindex(' ', @DT) + 1)) +
  4.     space(1) + LEft(@DT, Charindex(' ', @DT, Charindex(' ', @DT) + 1)) as datetime);
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top