codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#include <stdio.h> #include <time.h> typedef struct hour{ int hour; int minute; int second; int isdst; } Hour; typedef struct date{ int day; int month; int year; Hour hr; } Date; int main (void) { Date d; time_t now = time(0); struct tm temp; char buffer[80]; const char *format = "%m-%d-%Y %H:%M:%S"; temp = *localtime( &now ); d.day = temp.tm_mday; d.month = temp.tm_mon; d.year = temp.tm_year; d.hr.hour = temp.tm_hour; d.hr.minute = temp.tm_min; d.hr.second = temp.tm_sec; d.hr.isdst = temp.tm_isdst; strftime (buffer, 80, format, &temp); printf("Current local date and time: %s",buffer); return(0); }
Private
[
?
]
Run code
Submit