Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Wrong DateTime

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

    Wrong DateTime

    Hi,

    Why using this code:

    #region Variables
    private DateTime myDateTime;
    #endregion

    Print(myDateTime.Month.ToString());

    only returns a 1 ?

    #2
    guillembm, to what values did you set the DateTime value here? I can only see the variable declaration and print in your snippet.

    Comment


      #3
      I just print it on Initialize()

      If I print Print("date " + myDateTime.Date);

      then I get: date 1/1/0001 12:00:00 AM

      I really need to assig it to a variable to print it?

      My system time is ok

      Comment


        #4
        Sorry guillembm, I don't follow you - what are trying to print? Your myDateTime is just a DateTime variable which holds a default value, to make use of it you would need to assign your value. If you would like to access the system's PC clock, try working with DateTime.Now
        Last edited by NinjaTrader_Bertrand; 09-20-2011, 03:46 AM.

        Comment


          #5
          Very ashaming basic programming error.

          sorry

          Comment


            #6
            No worries guillembm, good luck on your project.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            91 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            48 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            31 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            34 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            69 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X