localtime


localtime

Converts a timer value into a year, month, day, hour, minute, second, and so on

 #include <time.h> struct tm *localtime ( const time_t *timer  ); 

The localtime( ) function converts a numeric time value (usually a number of seconds since January 1, 1970, but not necessarily) into the equivalent date and time structure for the local time zone. To obtain similar values for Coordinated Universal Time (UTC, formerly called Greenwich Mean Time), use the function gmtime( ).

The function's argument is not the number of seconds itself, but a pointer to that value. Both the structure type struct tm and the arithmetic type time_t are defined in the header file time.h. The tm structure is described at gmtime( ) in this chapter.

The argument most often passed to localtime( ) is the current time, obtained as a number with type time_t by calling the function time( ). The type time_t is usually defined in time.h as equivalent to long or unsigned long.

Example

See the example for gmtime( ) in this chapter.

See Also

asctime( ), difftime( ), gmtime( ), mktime( ), strftime( ), time( )



C(c) In a Nutshell
C in a Nutshell (In a Nutshell (OReilly))
ISBN: 0596006977
EAN: 2147483647
Year: 2006
Pages: 473

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net