need current day, month, year

This is a discussion on need current day, month, year within the C++ Programming forums, part of the General Programming Boards category; hi, i need to be able to get the current date but i want to be able to store the ...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    6

    need current day, month, year

    hi,

    i need to be able to get the current date but i want to be able to store the day, month and year in separate variables.

    thanks

  2. #2
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,655
    Code:
    
    
    void get_date( int * month, int * day, int * year ) {
    struct tm *current;
    time_t timenow;
    time(&timenow);
       current = localtime(&timenow);
         *month = current->tm_mon+1;
         *day = current->tm_mday;
         *year = current->tm_year+1900;
    return;
    }

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    6
    thanks Sebastiani

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Display day, month, year in different format
    By melodious in forum C++ Programming
    Replies: 5
    Last Post: 07-05-2007, 01:14 AM
  2. Problem with simple case statements
    By shoobsie in forum C Programming
    Replies: 2
    Last Post: 05-08-2006, 08:39 AM
  3. getting the next day's day, month, year etc
    By underthesun in forum C Programming
    Replies: 3
    Last Post: 02-17-2005, 06:43 AM
  4. compiler build error
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-30-2003, 09:16 AM
  5. HELP with starting out.
    By sworc66 in forum C Programming
    Replies: 4
    Last Post: 09-05-2002, 10:09 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21