C Board  

Go Back   C Board > General Programming Boards > FAQ Board

 
 
LinkBack Thread Tools Display Modes
Old 01-24-2002, 11:02 AM   #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
davie_scotland is offline  
Old 01-24-2002, 11:09 AM   #2
Code Goddess
 
Prelude's Avatar
 
Join Date: Sep 2001
Posts: 9,661
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
__________________
My best code is written with the delete key.
Prelude is offline  
Old 01-24-2002, 11:18 AM   #3
Registered User
 
Join Date: Jan 2002
Posts: 15
Cheers

Cheers I'll get that in my program right away thanks Davie
__________________
Davie
davie_scotland is offline  
 

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking array for string Ayreon C Programming 87 03-09-2009 03:25 PM
Sending an email in C program Moony C Programming 28 10-19-2006 10:42 AM
Read and set\change system time Hexxx C++ Programming 9 01-02-2006 07:11 AM
Help: Display time and date stansu C++ Programming 5 08-22-2003 02:27 PM


All times are GMT -6. The time now is 11:05 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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