Getting todays date in C?

This is a discussion on Getting todays date in C? within the C Programming forums, part of the General Programming Boards category; Dear All, I am trying to get current system time, so far i wrote as follows:- Code: #include <stdio.h> #include ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    83

    Getting todays date in C?

    Dear All,
    I am trying to get current system time, so far i wrote as follows:-

    Code:
    #include <stdio.h>
    #include <sys\types.h>
    
    void main( )
    { 
    time_t curtime ;
    char ctm[50] ;
    
    time ( &curtime ) ; //retrieves current time & stores in curtime
    printf ( "\nCurrent Date & Time: %s", ctime (&curtime ) ) ; 
    }
    i am getting 'time' and 'ctime' undeclared identifier.
    what is the header file for time and ctime?

    i am using Window XP operating system

    Thanks in advance
    Shwetha

  2. #2
    Registered User
    Join Date
    Oct 2008
    Location
    TX
    Posts
    2,057
    need to include <time.h>

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Advancing day by day until it matches a second date
    By nhubred in forum C++ Programming
    Replies: 1
    Last Post: 05-30-2009, 09:55 AM
  2. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 04:25 PM
  3. Output Text File Name by Today's Date
    By jbayne in forum C++ Programming
    Replies: 1
    Last Post: 07-09-2007, 09:09 AM
  4. Todays time and date
    By wozza in forum C Programming
    Replies: 7
    Last Post: 05-27-2002, 04:42 PM

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