• Nice ... the N-th datetime solutions payback time :hehe:

    Just for correctness ...

    can you elaborate and split your bigint into the date part and the timepart ?

    1196100822809

    1196 = NoDays

    10= HH

    08 = mm

    22 = ss

    809 = ms

    Correct ?

    Declare @mybigint bigint

    set @mybigint = 1196100822809

    print @mybigint

    declare @mychar char(23)

    declare @mycharwrk char(23)

    Select @mychar = convert(char(23), @mybigint )

    print cast(reverse(substring(ltrim(reverse(@mychar)), 10,10)) as int)

    select @mycharwrk = convert(char(10),dateadd(dd,cast(reverse(substring(ltrim(reverse(@mychar)), 10,10)) as int),'1900-01-01'),121)

    + ' ' + reverse(substring(ltrim(reverse(@mychar)), 8,2))

    + ':' + reverse(substring(ltrim(reverse(@mychar)), 6,2))

    + ':' + reverse(substring(ltrim(reverse(@mychar)), 4,2))

    + '.' + reverse(substring(ltrim(reverse(@mychar)), 1,3))

    print @mycharwrk

    declare @mydatetime datetime

    set @mydatetime = convert(datetime,@mycharwrk,121)

    print convert(char(23),@mydatetime,121)

    Print 'Did you notice the change in ms ?? !! '

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me