The Altair Community is migrating to a new platform to provide a better experience for you. In preparation for the migration, the Altair Community is on read-only mode from October 28 - November 6, 2024. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here

How to replace a time value

StarfishStarfish Member Posts: 5 Learner I
Hi dears
I've struggled to change a certain of time value for almost one day, which is turning the "12:00:00 AM" into "12:00:00 PM", I 've used "Date to nominal" to deal with it, but after doing so the time value would be changed, so I gave up this method.

Now I am trying to use "Generate Macro", but I have no idea how to write the function expression, could you please tell me?

Sincerely,
Starfish
Tagged:

Best Answer

  • ceaperezceaperez Member Posts: 541 Unicorn
    edited October 2021 Solution Accepted
    Hi @Starfish

    you can use the Generate Attributes to create a new attribute and use an if statement with  date_get method and DATE_UNIT_HOUR to extract the date hour, compare it with your target value and replace it with the  new value. 

    if(date_get([Date], DATE_UNIT_HOUR)==9,(date_set([Date],10, DATE_UNIT_HOUR )),date_get([Date], DATE_UNIT_HOUR))

    Best, 

    Cesar
Sign In or Register to comment.