Converting a text description of time to an ordinary Datetime value in SQL 2008
Posted on 2011-02-23
I want to convert a varchar expression describing time into a date time value. I will be given descriptions like this: 2010D320HR22MIN23
Which means the 320th day of Year 2010, Hour 22, Minute 23.
It may be equivalent to a string like this:
(Assuming 10-19 is the 320th day of 2010, I'm not sure if this is right)
So what I want is a function that takes 2010D320HR22MIN23 as input
and returns 2010-11-19 22:23:00.0000000
I don't see any function that converts day of year to month and day. Is there one? Or must one be built from scratch? Or is there another way of doing this?