Like Tree1Likes
  • 1 Post By Prelude

FAQ: How do i display current time and date ?

This is a discussion on FAQ: How do i display current time and date ? within the FAQ Board forums, part of the General Programming Boards category; Hi, I was looking for a bit of help. I'm just starting to learn C and as part of my ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    15

    FAQ: How do i display current time and date ?

    Hi, I was looking for a bit of help. I'm just starting to learn C and as part of my course I'm to produce a menu driven system to hold race times and competitor details. I'm struggling a bit on several aspects of. I was wondering if anyone could help me to display the current time and date on some of the screens of my menu. I am using the printf function to display text i would be very grateful for any help Cheers Davie
    Davie

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    
    int main(void)
    {
      time_t now;
      time(&now);
    
      printf("%s", ctime(&now));
    
      return EXIT_SUCCESS;
    }
    -Prelude
    Ether likes this.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Jan 2002
    Posts
    15

    Cheers

    Cheers I'll get that in my program right away thanks Davie
    Davie

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Checking array for string
    By Ayreon in forum C Programming
    Replies: 87
    Last Post: 03-09-2009, 04:25 PM
  2. Sending an email in C program
    By Moony in forum C Programming
    Replies: 28
    Last Post: 10-19-2006, 11:42 AM
  3. Read and set\change system time
    By Hexxx in forum C++ Programming
    Replies: 9
    Last Post: 01-02-2006, 07:11 AM
  4. Help: Display time and date
    By stansu in forum C++ Programming
    Replies: 5
    Last Post: 08-22-2003, 03:27 PM

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