Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ Language Reference - localtime http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   localtime
   Usage
   #include <time.h>
   struct tm *localtime(time_t *stime);

   Description
   localtime  converts a time stored as a time_t value to  the  structure
   tm.  The  time_t value stime is the seconds elapsed  since  1  January
   1970.  This  value can be obtained from the function  time.  localtime
   makes  corrections for time zones and possible daylight savings  time.
   The fields of the structure tm are:

   struct tm {
   tm_sec,
   /* seconds 0..59 */
   tm_min,
   /* minutes 0..59 */
   tm_hour,
   /* hour of day 0..23 */
   tm_mday,
   /* day of month 1..31 */
   tm_mon,
   /* month 0..11 */
   tm_year,
   /* years since 1900 */
   tm_wday,
   /* day of week, 0..6 (Sun..Sat) */
   tm_yday,
   /* day of year, 0..365 */
   tm_isdst;
   /*  >0 if daylight savings time */

   /* ==0 if not DST, < 0 if don't know */
   };

   Return Value
   localtime  returns  a pointer to the a static structure  tm  which  is
   overwritten by each call to localtime().

   Example
   #include <time.h>
   #include <stdio.h>
   main()
   {
   struct tm *t;
   time_t ltime;
        time(&ltime);
        t = localtime(&ltime);
        printf("The date is %d-%d-%d\n",t->tm_mday,
                  t->tm_mon+1,t->tm_year);
   }


See Also: time asctime ctime mktime

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson