Thread: Show time??

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    16

    Question Show time??

    I would like to know how to display the time.
    I know how to display the system clock
    all I want is the time (eg hours/mins/secs)

  2. #2
    of Zen Hall zen's Avatar
    Join Date
    Aug 2001
    Posts
    1,007
    Code:
    #include <iostream>
    #include <ctime>
    
    using namespace std;
    
    
    int main()
    {
    	time_t t;
    	struct tm* ti;
    
    	time(&t);
    	ti = localtime(&t);
    
    	cout << ti->tm_hour << ":" << ti->tm_min << ":" << ti->tm_sec<<endl;
    		
    	return 0;	
    }
    zen

  3. #3
    Registered User mik's Avatar
    Join Date
    Oct 2001
    Posts
    15

    Talking maybe this is it???

    #include <iostream.h>
    #include <time.h>
    #include <iostream.h>

    void main()
    {
    time_t hold_time;
    hold_time=time(NULL);
    cout<<ctime(&hold_time);

    }
    C:\
    C:\dos
    C:\dos run
    RUN dos RUN!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. show the menu only once each time..
    By transgalactic2 in forum C Programming
    Replies: 16
    Last Post: 01-05-2009, 04:37 AM
  2. Sending an email in C program
    By Moony in forum C Programming
    Replies: 28
    Last Post: 10-19-2006, 10:42 AM
  3. Is this really true or it's just science fiction?
    By Nutshell in forum A Brief History of Cprogramming.com
    Replies: 145
    Last Post: 04-09-2002, 06:17 PM
  4. time class
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-11-2001, 10:12 PM