Thread: Date in int

  1. #1
    Registered User
    Join Date
    Aug 2011

    Date in int

    I need a way of getting the date as integers from a computer.I can get:

    char curDate[9];
    	cout << "The current date is  " << curDate  << " \n";
    But is there a faster way of getting
    int day
    int month
    int year

    other can separating out the "/" and converting chars to int?

  2. #2
    spurious conceit MK27's Avatar
    Join Date
    Jul 2008
    segmentation fault
    #include <ctime>
    Use localtime() or another standard C library function which returns a struct tm containing int fields for day, month, year, etc.
    C programming resources:
    GNU C Function and Macro Index -- glibc reference manual
    The C Book -- nice online learner guide
    Current ISO draft standard
    CCAN -- new CPAN like open source library repository
    3 (different) GNU debugger tutorials: #1 -- #2 -- #3
    cpwiki -- our wiki on sourceforge

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Two date objects showing same date?
    By dxfoo in forum C++ Programming
    Replies: 7
    Last Post: 06-17-2010, 06:06 PM
  2. Am I up to date?
    By Kate in forum C# Programming
    Replies: 2
    Last Post: 10-10-2005, 03:08 AM
  3. Date program starts DOS's date
    By jrahhali in forum C++ Programming
    Replies: 1
    Last Post: 11-24-2003, 05:23 PM
  4. How to get Date
    By sikamikaniko in forum C++ Programming
    Replies: 3
    Last Post: 04-06-2003, 11:57 AM
  5. Something About Date
    By BernarD in forum C++ Programming
    Replies: 3
    Last Post: 09-02-2002, 09:54 PM