how to add fixed amount of minutes, to hours.

danielsoy
danielsoy New Altair Community Member
edited November 2024 in Community Q&A

Hello.

 

I need to add a fixed amount of minutes, to an attribute columm, that contains hours.

So if my hour attribute contains 12:00 for instance, it should contain 12:15 after the operation, in case I want to add 15 minutes.

 

my proccess.

 

Thanks a lot.

Best Answer

  • JEdward
    JEdward New Altair Community Member
    Answer ✓

    There's an operator called 'Adjust Date' which is very simple to configure.

    Select the attribute you want to adjust, select the unit you want to add(or subtract) in this case minutes, next type in the adjustment value. 

     

    For more complex calculations or to convert your hour column if it is stored as nominal then the Generate Attribute operator is your friend.  Here you can type something like:

    date_str_custom(
    date_add(
    date_parse_custom(myTimeAtt,"HH:mm"),15,DATE_UNIT_MINUTE
    )
    ,"HH:mm")

    This will convert your nominal value into a date add 15 minutes and then convert it back into a nominal value. 

Answers

  • JEdward
    JEdward New Altair Community Member
    Answer ✓

    There's an operator called 'Adjust Date' which is very simple to configure.

    Select the attribute you want to adjust, select the unit you want to add(or subtract) in this case minutes, next type in the adjustment value. 

     

    For more complex calculations or to convert your hour column if it is stored as nominal then the Generate Attribute operator is your friend.  Here you can type something like:

    date_str_custom(
    date_add(
    date_parse_custom(myTimeAtt,"HH:mm"),15,DATE_UNIT_MINUTE
    )
    ,"HH:mm")

    This will convert your nominal value into a date add 15 minutes and then convert it back into a nominal value. 

  • danielsoy
    danielsoy New Altair Community Member

    I ve got ¨PROBLEM OCCURRED¨ with Adjust Date operator related with the value type of my HOUR att.

     

    But I could make it with generate att n the proposed expression:

    solved

     

    Thanks JEdward for your help.

     

    Cheers!