Excel Time into Decimal. SQL Decimal into TIME

  • I have an excel cell that is a TIME format. Take 10:00:00 AM for example, when it is exported into a flat file it changes into text format and gives me 0.416666666666667.

    Is there such thing as a SQL query that can convert the decimal value back into a time or can this be only resolved on the Excel level?

    Thanks

  • You might find some inaccurate results, but a simple conversion to datetime then to time might work.

    SELECT CONVERT( time, CONVERT(datetime, 0.416666666666667))

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • Thank You.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply