To get the date of the form dd-mm-yy
#include <time.h>
#include <stdio.h>
void main()
{
/* to store the time in seconds since 1970 */
time_t time_secs;
/* to store time and date in the various fields of structure tm */
struct tm todays_date;
/* get the calendar time, seconds since 1970 */
time_secs = time(NULL);
/* convert to broken-down time, see struct tm */
todays_date = *localtime(&time_secs);
/* output */
printf("Todays date is %d-%d-%d",
todays_date.tm_mday, /* day, 1-31 */
todays_date.tm_mon+1, /* month, 0-11,
hence +1 */
todays_date.tm_year); /* year since
1900 */
}
----- Original Message -----
From: "Ricky boytoy" <boy...@ho...>
To: <dev...@li...>
Sent: Friday, September 28, 2001 5:01 AM
Subject: [Dev-C++] i need help
> hey there hope u guys r in great shape!
> i need so examples of using the headerfile time.h in c++
>
> cud u just tell me some basic functions of time.h
> i look forward to hear from u
> thank u
>
> _________________________________________________________________
> Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|