Can someone show me how I can output hrs:mins:secs in mySQL SELECT statement below?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dseals22
    New Member
    • Jan 2017
    • 74

    Can someone show me how I can output hrs:mins:secs in mySQL SELECT statement below?

    Here is what I have so far when use the DATE_ADD function in MySQL Workbench 6.3, but I have been struggling to output the hrs:mins:secs (you don't see the code for that output because I didn't write it here). I know that I can use INTERVAL HOUR_SECOND to display hrs:mins:secs but I don't understand how it works.


    Code:
    SELECT DATE_ADD('2017-01-26', INTERVAL 31 DAY) AS '31 Days';


    I know this SELECT statement above will output 31 days from the specified date indicated above, but what do I need to do to output the hrs:mins:secs along with the 31 days from the date in the SELECT statement?

    Below is the output of how I would like it to be, but the hours:minutes:s ecs must be time corresponding to 31 days after the day indicated above in my SELECT statement.
    Attached Files
  • RonB
    Recognized Expert Contributor
    • Jun 2009
    • 589

    #2
    Did you read the documentation for the date_add function? It has an example doing exactly what you want.


    Here's another example.
    Sorry! We can't seem to find the resource you're looking for

    Comment

    Working...