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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      129 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      74 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      116 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      110 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      89 views
      0 likes
      Last Post CarlTrading  
      Working...
      X