How to work with Date format in SQL: Set command

The following works:
SQL

Code:

SET($[$12.0.DATE]|SQL: SELECT CONVERT(VARCHAR(10), GETDATE(), 120))

So this should also work:

Code:

Set ($[$12.0.DATE]|SQL: SELECT CONVERT(VARCHAR(10), DateAdd(DD,30,GETDATE()),120));

The main reason is that the date has to be in format YYYY-MM-DD

HANA

Code:

Set($[$12.0.DATE]|SQL:SELECT TO_VARCHAR(CURRENT_DATE, 'yyyy-mm-dd') FROM DUMMY);

Was this article helpful?

3 out of 3 found this helpful

Comments

5 comments

  • Comment author
    Yaremi Miranda Lopez

    HANA:

    @STORE1 = SQL(SELECT TO_VARCHAR(T0."DocDueDate", 'yyyy-mm-dd') FROM "ORDR" T0 WHERE T0."DocNum" = 972);
    SET($[$12.0.DATE]|@STORE1);

    0
  • Comment author
    Lauren Downs

    Hi,

    I need the below to say IF ($[$BOYX_5.0.0]  > yesterday:

    What is the correct logic please?

    0
  • Comment author
    Dustin Bellew

    IF ($[$BOYX_5.0.0]  > getdate() -1

    -1
  • Comment author
    Anthony Mendoza

    Hello,

    This does not work when attempting to set a date field on a UDT that is handled through the UDT Handler. Image below. Am I missing something here?

    0
  • Comment author
    Chris F

    I have a macro to set the date on one window but another window only accepts the date in the mm/DD/YYYY format, how can I ask for one variable and it correctly sets it for both?

    Ex Var 1 = 02/02/25

    set item 1 = 02/02/25

    set item 2 = 02/02/2025

    0

Please sign in to leave a comment.