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 FrazMann, Today, 11:21 AM
            2 responses
            6 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by rjbtrade1, 11-30-2023, 04:38 PM
            2 responses
            80 views
            0 likes
            Last Post DavidHP
            by DavidHP
             
            Started by Spiderbird, Today, 12:15 PM
            1 response
            7 views
            0 likes
            Last Post NinjaTrader_ChristopherJ  
            Started by lorem, Yesterday, 09:18 AM
            5 responses
            18 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by cmtjoancolmenero, Yesterday, 03:58 PM
            12 responses
            42 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X