Validate Syntax

Good day,

Just want to confirm if my syntax is correct?

CONCAT(FLOOR(([record_age] / 86400000)), ' days, ', FLOOR((([record_age] % 86400000) / 3600000)), ' hours, ', FLOOR((([record_age] % 3600000) / 60000)), ' minutes, and ', FLOOR((([record_age] % 60000) / 1000)), ' seconds')

I was intending to convert a milliseconds column to number of days, hours, minutes, or seconds.

Appreciate anyone suggestions.

Best Answers

  • Ashleigh
    Ashleigh Coach
    Answer ✓

    @LJ I think you need to remove or change the [] and the %

    **If this answer solved your problem be sure to like it and accept it as a solution!

  • DavidChurchman
    Answer ✓

    For the mod operation, you can't use %, you'll need the MOD() function.

    For example, for your hours:

    FLOOR( (MOD(record_age , 86400000) / 3600000)

    Please 💡/💖/👍/😊 this post if you read it and found it helpful.

    Please accept the answer if it solved your problem.

Answers

  • Ashleigh
    Ashleigh Coach
    Answer ✓

    @LJ I think you need to remove or change the [] and the %

    **If this answer solved your problem be sure to like it and accept it as a solution!

  • DavidChurchman
    Answer ✓

    For the mod operation, you can't use %, you'll need the MOD() function.

    For example, for your hours:

    FLOOR( (MOD(record_age , 86400000) / 3600000)

    Please 💡/💖/👍/😊 this post if you read it and found it helpful.

    Please accept the answer if it solved your problem.