ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Subtract Days from a timestamp field?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Subtract Days from a timestamp field?

    Does anyone know how to subtract days from a timestamp field?
    I have seen this work in other programs using CURRENT TIMESTAMP:

    CURRENT TIMESTAMP - 62 DAYS

    But when I try to do it using my timetamp field I get an error.

    TB01025-EFF-TMSTAMP - 62 DAYS


    Thanks,

  • #2
    Re: Subtract Days from a timestamp field?

    In ILE/Cobol you can use the intrinsic function subtract-duration.

    Code:
    move function SUBTRACT-DURATION (WS-Old-Date DAYS 1) to WS-New-Date
    Here's an article on computing differences between two dates that illustrates other examples of instrinsic date functions:



    Here's a link to the ILE/Cobol reference manual for V5R3:




    Terry
    Last edited by Terry Wincheste; February 13, 2008, 05:24 AM.

    Comment


    • #3
      Re: Subtract Days from a timestamp field?

      Thank you for your response.
      This is what ended up working for me...

      Where
      DATE(A.DB_TMSTAMP) > DATE(:TB01025-EFF-TMSTAMP) -
      62 DAYS

      Comment

      Working...
      X