CREATEDATETIME function-query

idonthvididonthvid Member Posts: 12
Hi,
While using the CREATEDATETIME function,the output is something like this 98 days 2 minutes 40 seconds 155 milliseconds.

But i want the output just in days,hours and minutes.Can anyone give me a solution for this???

Comments

  • DaveTDaveT Member Posts: 1,039
    Hi,

    This function create a DateTime value - how are you displaying it?

    Have a look at the help on the FORMAT function and "Format Properties" - Default format 0 seems to be what you need.
    Dave Treanor

    Dynamics Nav Add-ons
    http://www.simplydynamics.ie/Addons.html
  • kinekine Member Posts: 12,562
    Use ROUNDDATETIME function to round the value to hours/minutes before displaying it...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • idonthvididonthvid Member Posts: 12
    kine wrote:
    Use ROUNDDATETIME function to round the value to hours/minutes before displaying it...

    But the variable i am using to display the result is of datatype "DURATION", and this ROUNDDATETIME is of datatype "Datetime"...How to proceed with that?
  • idonthvididonthvid Member Posts: 12
    DaveT wrote:
    Hi,

    This function create a DateTime value - how are you displaying it?

    Have a look at the help on the FORMAT function and "Format Properties" - Default format 0 seems to be what you need.

    Default format 0 is again displaying the whole string with milliseconds too...I just want it in days,hrs and minutes...Any other way please?
  • kinekine Member Posts: 12,562
    idonthvid wrote:
    kine wrote:
    Use ROUNDDATETIME function to round the value to hours/minutes before displaying it...

    But the variable i am using to display the result is of datatype "DURATION", and this ROUNDDATETIME is of datatype "Datetime"...How to proceed with that?

    Sorry, I have overlooked this...

    Because Duration is just bigint with number of milliseconds, you can use something like:
        gduDuration := gduDuration - (gduDuration MOD 60000);
    

    to round the duration to minutes etc...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.