Date and Time Function

N

newbie@C

Greetings,

I would like to add a date/time function to a program. I would like to be
able to do something like this:

total=age*365+(current date as per users system clock)

See below for the code so far (yes, I am brand spanking new) -

Thanks.

/* Age Converter */
/* age.c */
/* Created on November 8, 2003 */

main()
{
int age,total;
char name[20];

printf("Hello.\n");
printf("\n");
printf("Welcome to my Age Converter!\n");
printf("\n");
printf("What is your name?\n");
scanf("%s",&name);
printf("\n");
printf("O.K. %s, enter your age in years and I'll convert it into
days:",name);
scanf("%d",&age);
total=age*365;
printf("\n");
printf("Your age in days is %d",total);
printf("\n");
}
---
"I wanted to do good without fuss, for I found, that fuss does no good and
that the good makes no fuss."

Louis-Claude de Saint-Martin.
The Unknown Philosopher
 
M

Mark McIntyre

Greetings,

I would like to add a date/time function to a program. I would like to be
able to do something like this:

total=age*365+(current date as per users system clock)

you will find the functions and structures listed in time.h useful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top