![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Mar 2007
Location: , ,
Posts: 234
Thanks: 1
Thanked 2 times in 2 posts
|
I'm trying to format a DateTime string in a DrawText object. It compiles but doesn't do any special formatting.
DrawText("BarTimeDn", String.Format("{0:m mm}",ElapsedTime),-2,Volume[0]/2,Color.Black); // Write BatTime to chart In the attached picture you can see the output is of the form: 00:00:00 - or hh:mm:ss. I actually want mm:ss. The variable "ElapsedTime" is a TImeSpan variable. Is that the problem? Does the String.Format() only work on DateTime variables? regards, taddypole... |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,421
Thanks: 252
Thanked 982 times in 964 posts
|
Yes Taddypole, I believe you would need to convert the Timespan first to DateTime and then could apply your String.Format customizations for display.
Bertrand
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Release 8. Half way fix of datetime format ? | zweistein | Charting | 7 | 09-10-2012 03:56 AM |
| About the text format of DrawText method | keven | General Programming | 6 | 02-18-2011 07:27 PM |
| Does DrawText auto-trim a string? | marketmasher | General Programming | 5 | 04-15-2009 09:39 AM |
| Input string was not in a correct format | auto9817 | Connecting | 23 | 02-27-2009 05:21 AM |
| String in incorrect format | Burga1 | General Programming | 2 | 05-07-2008 12:04 PM |