displaying date and time

This is a discussion on displaying date and time within the C Programming forums, part of the General Programming Boards category; Is there any possible way to display the date and time that my program was executed?...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    88

    displaying date and time

    Is there any possible way to display the date and time that my program was executed?

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Code:
    #include <stdio.h>
    #include <time.h>
    
    int main(void)
    {
       time_t now = time(NULL);
       puts(asctime(localtime(&now)));
       /* [edit]
       puts(ctime(&now));
       [/edit] */
       return 0;
    }
    Last edited by Dave_Sinkula; 09-08-2003 at 12:45 PM.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Wannabe Coding God
    Join Date
    Mar 2003
    Posts
    259
    if you want to save it for later you can always trow it down in a file aswell.
    They say that if you play a Windows Install CD backwords, you hear satanic messages. That's nothing; play it forward and it installs Windows.

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. Sending an email in C program
    By Moony in forum C Programming
    Replies: 28
    Last Post: 10-19-2006, 11:42 AM
  4. Displaying time and date of files
    By wozza in forum C Programming
    Replies: 3
    Last Post: 05-25-2002, 12:53 PM

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