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:	101
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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    637 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    366 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    107 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    569 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    571 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X