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

This is a discussion on how to pull system time, date, etc from <ctime> within the C++ Programming forums, part of the General Programming Boards category; How can i pull the system date, time, etc..using the ctime.h head file? I also looked in ctime.c any help ...

  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, 09: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, 08:09 PM
  4. reading the system date
    By Alicia in forum C++ Programming
    Replies: 5
    Last Post: 02-13-2002, 02:18 PM
  5. Setting the System Time
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-01-2001, 10:18 AM

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