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 -

    http://www.ninjatrader-support.com/H...V6/ToTime.html

    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 mkhuophgqwdk, Today, 10:41 PM
    0 responses
    1 view
    0 likes
    Last Post mkhuophgqwdk  
    Started by dmelleady, Today, 10:18 PM
    0 responses
    6 views
    0 likes
    Last Post dmelleady  
    Started by arangocj, Today, 09:46 PM
    1 response
    5 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by rgoudie, Today, 09:13 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by bosajin, Today, 03:48 PM
    3 responses
    11 views
    0 likes
    Last Post bosajin
    by bosajin
     
    Working...
    X