CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    53

    Why is it always 1 january 1970??

    Hey i have a question, i use a "date time picker" in my projekt and i works ok but for some time now it always show "1970-01-01" whenever i start my program, whats that about?? It's always todays date in the resource view and thats what i want it to be.

    I remeber i've read somewere that there, supposedly, is something special with that date and c++ but that doesnt make me any wiser in this particular problem.

    any suggestions on how to make it alwats show todays date when i run my prog??

    thanx

    /Eric

  2. #2
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    You have to initialize the date/time picker to the current date. If you use it uninitialized, it will show the 'NULL' date 01-01-1970.

  3. #3
    Join Date
    May 2003
    Posts
    4

    Lightbulb

    The inbuilt function (_time) that you use always sets the date and time to jan 1 1970. thats why whenever u start the program you automatically get the above date & time .
    regards

  4. #4
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    53
    yeah i kinda realized that too but i dont really know how.. i cant get the CTime and COleDateTime stuff to work for me

    /Eric

  5. #5
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    53
    note: my reply was to what gstercken wrote, thanx for your answer jintojohnson

    /Eric

  6. #6
    Join Date
    Sep 2002
    Location
    14° 39'19.65"N / 121° 1'44.34"E
    Posts
    9,815
    You have probably created a DDX member variable of type CTime for your control. The default initialization created by class Wizard (in you Dialog's ctor) is '=0'. Just replace this by '=CTime::GetCurrentTime()'.

  7. #7
    Join Date
    Apr 2003
    Location
    Sweden
    Posts
    53
    thanx alot gstercken!!

    /Eric

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured