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 Mindset, 04-21-2026, 06:46 AM
            0 responses
            105 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            147 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            71 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            125 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            79 views
            0 likes
            Last Post PaulMohn  
            Working...
            X