Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Printing short formate time to output window

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

    Printing short formate time to output window

    Hello,

    I need to print the current time in a short format: "08:30" ... "15:30" (without AM/PM and with "0" in "08:30"). "Print(Time[0].ToString()); gives the full date/time which I don't need." Would you please help?

    Thank you.

    #2
    Hello dmitry75,

    Thank you for your post.

    You can use TimeOfDay to achieve this:
    Code:
    Print(Time[0].TimeOfDay.ToString());
    This will however keep the ':00' at the end of the time, you may wish to look into regular expression in .NET to alter strings: http://msdn.microsoft.com/en-us/library/hs600312.aspx

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

    Comment


      #3
      Thank you, actually I needed the real time, not the bar time. Maybe it would be useful to somebody:

      Code:
      Print (Bars.MarketData.Connection.Now.ToString("HH:mm");
      Last edited by dmitry75; 09-18-2013, 03:01 PM.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by WHICKED, Today, 02:02 PM
      1 response
      4 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by selu72, Today, 02:01 PM
      0 responses
      3 views
      0 likes
      Last Post selu72
      by selu72
       
      Started by f.saeidi, Today, 12:14 PM
      8 responses
      21 views
      0 likes
      Last Post f.saeidi  
      Started by Mikey_, 03-23-2024, 05:59 PM
      3 responses
      49 views
      0 likes
      Last Post Sam2515
      by Sam2515
       
      Started by Russ Moreland, Today, 12:54 PM
      1 response
      7 views
      0 likes
      Last Post NinjaTrader_Erick  
      Working...
      X