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 CarlTrading, 03-31-2026, 09:41 PM
            1 response
            67 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            36 views
            0 likes
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            59 views
            1 like
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            62 views
            0 likes
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            53 views
            0 likes
            Last Post CarlTrading  
            Working...
            X