Start a Conversation

This post is more than 5 years old

Solved!

Go to Solution

4278

May 29th, 2017 01:00

How to compare two time values in asl script

Hi,

Any body can guide how two values of time can be compared using ASL script I have used this code but somehow its not working

if(time() > time(1496061600)){

print(time()." Is Greater than ".time(1496061600));}

I have tried this comparison in different ways by even converting it to numeric value but it is not working.

14 Posts

July 19th, 2017 11:00

Dear Prashanth,

      I got your point, but my problem is somewhat different as I am trying to send emails through smarts email adapter only during 9:00 am to 18:00 and prohibit rest of hours.

I want to compare email time with current system time if it is between 9:00  and 18:00 hours send the email otherwise do not send email. I would be great if you can solve my problem.

5 Practitioner

 • 

274.2K Posts

July 24th, 2017 15:00

Hello Nukhanpk,

I would like to confirm with you what the end goal of the script is. Is the end goal to only send emails during a specific time frame?

14 Posts

July 24th, 2017 22:00

Dear Lisa,

   I have been asked by customer to customize email adapter in smarts to:

  • Send emails of specific domain only between office hours (9:00 am to 6:00 pm).
  • After business hours mail adapter is configured in a way that emails containing a string in subject ("ACCESS") are not sent.

I have worked with both [mail-filter.asl and mail-custom.asl] by writing some functions to return business hours and specific string in subject but somehow ASL is not working while processing "if condition" during sending email.

On the other hand functions are working fine and returning required information.

for reference: below is function call

*******************************************************************

v=SPLIT(string(time()),":"); //Send current time to function

*******************************************************************

here is if condition controlling mail sending:

******************************************************************

if (numeric(substring(v,sizeof(v)-2,2))==8){ return;} //if function returns 8 then stop sending email

*****************************************************************

Function is:

SPLIT(str, delimiter) {

        input = str;

        delim = "";

        local var;

        local vars = list();

        rep(

                {

                        var: { .. delimiter }

                        do { vars += substring(var, 0, sizeof(var)-sizeof(delimiter)); }

                        do { return vars;}  // Return the string when first delimiter is found

                } | {

                        var: rep(word | fs)

                        do { vars += var; }

                }

        )?

        do { return vars; }

No Events found!

Top