Thread: DateTime_GetSystemTime function

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    215

    DateTime_GetSystemTime function

    Does anyone know how to use this function


    DWORD DateTime_GetSystemtime(
    HWND hwndDP,
    LPSYSTEMTIME lpSysTime
    );


    Thanks! :-)

  2. #2
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    Erm....I believe you need a datetime common control created to use this....here's the msdn page on it:

    http://msdn.microsoft.com/library/de...Systemtime.asp

    not sure exactly what you're needing to use it for though....

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    215
    Well what i want to do is get the year, month, day, and put each into a respective combo box, and make the combo box start out with the current date, but to allow the user to change the date to whatever they want, but i basically want it so that when this thing first loads, that it starts off with the current date.

    So today is August 2, 2004, one combo box will be in the 8th positiion which would be August, the other would be on 2 and then the last would be 2004. and then the user can search between whatever dates they wished. Im not sure if you understand what I mean, but I just want it to i can get the date and put each part into a combo box and have it start on that position.
    Last edited by osal; 08-02-2004 at 04:24 PM.

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    Use the GetSystemTime API

    DateTime_GetSystemtime probably calls that or at least gets it's info form the same place anyway

    http://msdn.microsoft.com/library/de...systemtime.asp

  5. #5
    Registered User
    Join Date
    May 2004
    Posts
    215
    Well how do u do it? I mean how do you code it, I dont understand

  6. #6
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    I just added a link, see that

  7. #7
    Registered User
    Join Date
    May 2004
    Posts
    215
    I went to the link but it has no code on how to do it. I mean this is what I did, but it didnt work.

    Code:
    char datebuffer[30];
    GetSystemTime(datebuffer);

  8. #8
    Software Developer jverkoey's Avatar
    Join Date
    Feb 2003
    Location
    New York
    Posts
    1,905
    The function takes a LPSYSTEMTIME variable. You have to do something like:

    Code:
     SYSTEMTIME sysTime;
     GetSystemTime(&sysTime);
    for it to work correctly.

  9. #9
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    >>>
    void GetSystemTime(
    LPSYSTEMTIME lpSystemTime
    );
    <<<

    From Fordy's link.

    >>> but it has no code on how to do it

    It shows you the prototype of the function. It says it returns nothing and takes a single parameter of type LPSYSTEMTIME. Of course passing it a char string won't work, it's looking for something else. If you are going to use the API routines, you'll need to learn to read the documentation, otherwise you'll be scratching your head over every call.

    The SYSTEMTIME structure is also described in the documentation. There is a link to it on Fordys link.

    As an aside, GetSystemTime() retrieves the time in UTC. If you want the current date/time where you are, corrected for time zone and daylight savings, you should use the GetLocalTime() function instead.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  10. #10
    Registered User
    Join Date
    May 2004
    Posts
    215
    Excellent, thanks to all of you, i got my program to work. Thanks a lot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM