Thread: need current day, month, year

  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,708
    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;
    }
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  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, 07:43 AM
  4. compiler build error
    By KristTlove in forum C++ Programming
    Replies: 2
    Last Post: 11-30-2003, 10:16 AM
  5. HELP with starting out.
    By sworc66 in forum C Programming
    Replies: 4
    Last Post: 09-05-2002, 10:09 AM