Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Rearranging ToDay(time[0]) to read mm/dd instead of yyyymmdd

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

    Rearranging ToDay(time[0]) to read mm/dd instead of yyyymmdd

    I just want to label something with the date, and everything just pushes me to the micrsoft page that just doesnt seem relavant. is there not a simple way to get the current date and use it in a label in a couple lines of code?

    I have this for code
    Draw.Rectangle(this, ("OPENRECTANGLE" + CurrentBar), false, TODAY, OPENHIGH, TODAY.AddHours(LENGTH), OPENLOW, Brushes.DarkGreen, Brushes.DarkGreen, 40, true);
    LabeledLine myVLine = DrawLL.LabeledLine(this, ("OPEN PRICE" + CurrentBar), false, TODAY, OPENPRICE, TODAY.AddHours(LENGTH), OPENPRICE, Brushes.White, DashStyleHelper.Dash, 2);
    myVLine.DisplayText = ( "NY OPEN " + ToDay(Time[0]));​

    Shows up like this I just want it to red NY OPEN 08/30
    .​Click image for larger version

Name:	image.png
Views:	111
Size:	8.3 KB
ID:	1266883

    #2
    Hello JPMARTINUS,

    Thanks for your notes.

    There are no means available for changing how the ToDay() method returns the date.

    From the ToDay() help guide page: "Integer representation of day is format as yyyyMMdd where January 8, 2015 would be 20150108."

    See this help guide page for more information: https://ninjatrader.com/support/help.../nt8/today.htm

    You would need to use C# DateTime logic if you want to get the month and day in your script. To learn more about using C# DateTime in a custom NinjaScript, you could do a quick Google search for something like 'Get month and day C#' or 'Get month and day DateTime C#'.

    Note that we do not provide C# education in our support at NinjaTrader.
    <span class="name">Brandon H.</span><span class="title">NinjaTrader Customer Service</span><iframe name="sig" id="sigFrame" src="/support/forum/core/clientscript/Signature/signature.php" frameborder="0" border="0" cellspacing="0" style="border-style: none;width: 100%; height: 120px;"></iframe>

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by charlesugo_1, 05-26-2026, 05:03 PM
    0 responses
    67 views
    0 likes
    Last Post charlesugo_1  
    Started by DannyP96, 05-18-2026, 02:38 PM
    1 response
    149 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 05-11-2026, 05:56 AM
    0 responses
    162 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 05-10-2026, 08:12 PM
    0 responses
    99 views
    0 likes
    Last Post CarlTrading  
    Started by Hwop38, 05-04-2026, 07:02 PM
    0 responses
    286 views
    0 likes
    Last Post Hwop38
    by Hwop38
     
    Working...
    X