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 llanqui, Today, 10:32 AM
    0 responses
    1 view
    0 likes
    Last Post llanqui
    by llanqui
     
    Started by StockTrader88, 03-06-2021, 08:58 AM
    45 responses
    3,992 views
    3 likes
    Last Post johntraderuser2  
    Started by TAJTrades, Today, 09:46 AM
    0 responses
    7 views
    0 likes
    Last Post TAJTrades  
    Started by rhyminkevin, Yesterday, 04:58 PM
    5 responses
    62 views
    0 likes
    Last Post dp8282
    by dp8282
     
    Started by realblubb, Today, 09:28 AM
    0 responses
    8 views
    0 likes
    Last Post realblubb  
    Working...
    X