Scroll Down to See All
abortabsacosasctimeasctime_rasinassertatanatan2atexitatofatoiatolbsearchbtowccalloccatclosecatgetscatopenceilclearerrclockcoscoshctimectime_rdifftimediverferfcexitexpfabsfclosefdopenfeofferrorfflushfgetcfgetposfgetsfgetwcfgetwsfopenfprintffputcfputwsfreadfreefreopenfrexpfscanffseekfsetposftellfwidefwprintffwritefwscanfgetcgetchargetenvgetwcgetwchargmtimegmtime_rhypotisalnumisalphaisasciiisblankiscntrlisdigitisgraphislowerisprintispunctisspaceisupperiswalnumiswalphaiswblankiswcntrliswctypeiswdigitiswgraphiswloweriswprintiswpunctiswspaceiswupperiswxdigitisxdigitj0j1jnlabsldexpldivlocaleconvlocaltime_rloglog10longjmpmallocmblenmbrlenmbrtowcmbsinitmbsrtowcsmbstowcsmbtowcmemchrmemcmpmemcpymemmovememsetmktimemodfnextafternextafterlnexttowardnexttowardlnl_langinfoperrorpowprintfputcputcharputenvputsputwcputwcharqsortquantexpd32quantexpd64quantexpd128quantized32quantized64quantized128samequantumd32raiserandrand_rreallocregcompregerrorregexecregfreeremoverenamerewindscanfsetbufsetjmpsetlocalesetvbufsignalsinsinhsnprintfsprintfsqrtsrandsscanfstrcasecmpstrcatstrchrstrcmpstrcollstrcpystrcspnstrerrorstrfmonstrftimestrlenstrncasecmpstrncatstrncmpstrncpystrpbrkstrptimestrrchrstrspnstrstrstrtodstrtod32strtod64strtod128strtofstrtokstrtok_rstrtolstrtoldstrtoulstrxfrmswprintfswscanfsystemtantanhtimetime64tmpfiletmpnamtoasciitolowertouppertowctranstowlowertowupperungetcungetwcva_argva_copyva_endva_startvfprintfvfscanfvfwprintfvfwscanfvprintfvscanfvsprintfvsnprintfvsscanfvswprintfvswscanfvwprintfvwscanfwcrtombwcscatwcschrwcscmpwcscollwcscpywcscpywcsftimewcslenwcsncatwcsncmpwcsncpywcspbrkwcsptimewcsrchrwcsrtombswcsspnwcsstrwcstodwcstod32wcstod64wcstod128wcstofwcstokwcstolwcstoldwcstombswcstoulwcsxfrmwctobwctombwctranswctypewcwidthwmemchrwmemcmpwmemcpywmemmovewmemsetwprintfwscanfy0y1yn



Function Details : localtime

struct tm *localtime(const time_t * timer) ;

Return Type : struct tm *

A pointer to a `struct tm`, which represents a broken-down calendar time. The structure contains fields such as year, month, day, hour, minute, and second for representing human-readable time.
Read about return values of localtime function .

1st Parameter Type : const time_t *

A pointer to a constant `time_t` object, representing time as the number of seconds since the epoch (00:00:00 UTC, January 1, 1970). The data it points to cannot be modified.

1st Parameter

Pointer to a `time_t` object representing the time in seconds since the epoch.

Read more about parameters of localtime in parameters section
The localtimefunction in C language Converts calendar time to local time.
The localtime function converts the calendar time pointed to by timer into a broken-down time representation, expressed as local time (as opposed to UTC). The result is stored in a statically allocated structure which may be overwritten by subsequent calls to any of the date and time functions.
The localtimefunction takes 1 parameter:
  • const time_t * `timer`: Pointer to a `time_t` object representing the time in seconds since the epoch.
Converts the given time value pointed to by `timer` into a broken-down local time representation, expressed as a `struct tm`. Returns a pointer to a static `struct tm` that contains the local time components, such as year, month, day, hour, minute, and second.
The localtime function return value :
  • Returns a pointer to a struct tm representing the broken-down time, or a null pointer if the specified time cannot be converted to local time

Output

This example demonstrates basic usage of localtime to get the current local time.