Thread: how to pull system time, date, etc from <ctime>

  1. #1
    Matt
    Guest

    how to pull system time, date, etc from <ctime>

    How can i pull the system date, time, etc..using the ctime.h head file? I also looked in ctime.c

    any help would be great,

    thanks in advance

    mp

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    156
    This will do it for you:

    Code:
    #include <time.h>
    #include <stdio.h>
    
    void main( void )
    {
       time_t ltime;
    
       time( &ltime );
       printf( "The time is %s\n", ctime( &ltime ) );
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2009, 10:25 AM
  2. Replies: 4
    Last Post: 06-13-2005, 09:03 AM
  3. how to get system date
    By ssharish in forum C Programming
    Replies: 7
    Last Post: 03-03-2005, 09:09 PM
  4. reading the system date
    By Alicia in forum C++ Programming
    Replies: 5
    Last Post: 02-13-2002, 03:18 PM
  5. Setting the System Time
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-01-2001, 11:18 AM