Search
 
SCRIPT & CODE EXAMPLE
 

C

how to get time and date in c

#include <stdio.h>
#include <time.h>

int main()
{
  time_t t = time(NULL);
  struct tm tm = *localtime(&t);
  printf("now: %d-%02d-%02d %02d:%02d:%02d
", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
}
Comment

c get time

/* localtime example */
#include <stdio.h>
#include <time.h>

int main ()
{
  time_t rawtime;
  struct tm * timeinfo;

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );
  printf ( "Current local time and date: %s", asctime (timeinfo) );
  
  return 0;
}
Comment

PREVIOUS NEXT
Code Example
C :: sstf program in c 
C :: arma 3 get group size 
C :: roll binary c 
C :: C overwrite last line 
C :: golden cobblestone modpack 
C :: C float division 
C :: how to prevent user from entering char when needing int in c 
C :: c boolean 
C :: %hd c 
C :: malloc int array c 
C :: how to remove from a string c 
C :: factorial in c using recursion 
C :: c for schleife 
C :: c printf uint32_t 
C :: format bool c 
C :: tkinter create_line 
C :: right side of div 
C :: c# for loop decrement 
C :: Hello world in C programming language 
C :: C Program to Find Largest and Smallest Number among N 
C :: count distinct characters in a string C 
C :: enum in c 
C :: how i send custom data in model field rest_framework serializer 
C :: c strstr 
C :: c bubble sort 
C :: continue statement in c 
C :: #0000ff 
C :: choose random number with weight 
C :: ltoa in c 
C :: print the name of a file c 
ADD CONTENT
Topic
Content
Source link
Name
7+4 =