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.
    BertrandNinjaTrader Customer Service

    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.
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Very ashaming basic programming error.

          sorry

          Comment


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

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by kujista, Yesterday, 12:39 AM
            3 responses
            15 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by Yasharandom, 05-04-2024, 07:45 AM
            2 responses
            23 views
            0 likes
            Last Post Yasharandom  
            Started by francesjandujar, Today, 05:15 AM
            0 responses
            2 views
            0 likes
            Last Post francesjandujar  
            Started by francesjandujar, Today, 05:14 AM
            0 responses
            0 views
            0 likes
            Last Post francesjandujar  
            Started by knowmad, Today, 03:52 AM
            0 responses
            17 views
            0 likes
            Last Post knowmad
            by knowmad
             
            Working...
            X