Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011
    Location
    Washington, DC
    Posts
    3

    Unanswered: using dateadd to convert int to mm:ss

    I need to convert an interger to mm:ss. The value, duration, is stored in seconds as an int, 123456. This should be translated as 123.456 seconds. On select I need to convert that to mm:ss. For my purposes I can truncate everything to the right of the decimal. Is dateadd the right approach here? I'm not an SQL expert, just a weeny writing reports. Thanks for any help you can provide.

    Jamie

  2. #2
    Join Date
    May 2005
    Location
    South Africa
    Posts
    1,365
    Provided Answers: 1
    ?
    select right(convert(char(8),dateadd(ss,123456/1000,''),108),5)

  3. #3
    Join Date
    Aug 2011
    Location
    Washington, DC
    Posts
    3

    dateadd

    This work! Thank you.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •