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 The_Sec, Today, 02:29 PM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Jesse  
      Started by jeronymite, 04-12-2024, 04:26 PM
      2 responses
      30 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by Mindset, 05-06-2023, 09:03 PM
      10 responses
      265 views
      0 likes
      Last Post NinjaTrader_BrandonH  
      Started by michi08, 10-05-2018, 09:31 AM
      5 responses
      743 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by tsantospinto, 04-12-2024, 07:04 PM
      4 responses
      63 views
      0 likes
      Last Post aligator  
      Working...
      X