Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Select time window every month

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

    Select time window every month

    Hi all!!
    I'm searching to select a range date every month from ninjascrpit calendar management (Example consider every month the days between 1 and 15).
    How can I do??
    Thanks for all...

    #2
    Hello kantkant2,

    If you use the Time[0] methods then you can compare very easily.

    In Ninjascript the times and dates are converted to integer values making it very easy to do checks based on dates.

    Here is a simple example that checks if the current bar is between the 1st and the 15th day in the month. There is no need to specify anything except that the day is less than or equal to the 15th because the only values you will get when checking the date will be a number between 1 and 31.

    Code:
    if(Time[0].Day <= 15)
    {
    //Do Logic when the day is less than the 15th of each month
    } else {
    //Do something else	
    }
    You can also use ToDay() to specify specific dates if that is something you need
    Code:
    if (ToDay(2014, 4, 23) < ToDay(2014, 4, 15))
    {
    //Logic goes here
    }

    Here are some reference links on the way time works in Ninjascript




    Please let me know if I may be of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    648 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    574 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X