Compare 2 dates do not work

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ciryaj
    Member
    • Mar 2018
    • 47

    #1

    Compare 2 dates do not work

    I want to compare duedate and datetoday
    HTML Code:
    dateEnd=string\concatenate(
    datetime\year(datetime\today()),"-",
    datetime\month(datetime\today()),"-",
    subscriptionProfile.billingDueDate,
    " 00:00:00");
    
    ifThen(status=="Open",
    ifThenElse(datetime\today() < dateEndDate,
    status="Overdue",status="Open"));
    I am getting the correct dates but it won't compare for some reason it always returns TRUE thus always making it Overdue.

    Any help is appreciated.
    Last edited by ciryaj; Today, 06:13 AM.
  • ciryaj
    Member
    • Mar 2018
    • 47

    #2
    Originally posted by ciryaj
    I want to compare duedate and datetoday
    HTML Code:
    dateEnd=string\concatenate(
    datetime\year(datetime\today()),"-",
    datetime\month(datetime\today()),"-",
    subscriptionProfile.billingDueDate,
    " 00:00:00");
    
    ifThen(status=="Open",
    ifThenElse(datetime\today() < dateEndDate,
    status="Overdue",status="Open"));
    I am getting the correct dates but it won't compare for some reason it always returns TRUE thus always making it Overdue.

    Any help is appreciated.
    Fixed it by using different logic

    Code:
    dateEnd=string\concatenate(
    datetime\year(datetime\today()),"-",
    datetime\month(datetime\today()),"-",
    subscriptionProfile.billingDueDate,
    " 00:00:00"
    );
    
    $diff=datetime\diff(dateEnd,datetime\now());
    ifThenElse(
    status="Open" && $diff<0,
    status="Overdue",status="Open");

    Comment


    • shalmaxb
      shalmaxb commented
      Editing a comment
      Thank you for posting the solution, as you found it. This is how a forum works!
Working...