Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Want to check if the computer clock time is less than a specific time

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

    Want to check if the computer clock time is less than a specific time

    I have the following code:

    if (DateTime.Now.TimeOfDay < ToTime(10, 00, 00))
    {
    Print("Less than");
    }


    and Im getting the following error
    "Operator '<' cannot be applied to operands of type 'System.TimeSpan' and 'int'"

    I thought ToTime would be of type TimeSpane too?

    Whats the correct syntax?

    Thanks

    #2
    mefTrader, no ToTime() returns an Int value -



    Do you need the TimeOfDay timespan specifically?

    This below should compile -

    Code:
     
    if (ToTime(DateTime.Now) < ToTime(10, 00, 00))
    {
    Print("Less than");
    }
    BertrandNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by manueldecastro, Today, 01:16 PM
    2 responses
    9 views
    0 likes
    Last Post manueldecastro  
    Started by tradingnasdaqprueba, Today, 03:42 AM
    9 responses
    35 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by llanqui, Yesterday, 03:51 PM
    6 responses
    27 views
    0 likes
    Last Post NinjaTrader_Gaby  
    Started by AlgoDreamer, Today, 12:39 PM
    2 responses
    9 views
    0 likes
    Last Post AlgoDreamer  
    Started by ninza33, Today, 12:31 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_LuisH  
    Working...
    X