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 :: plt hide axis ticks 
C :: boolean in c 
C :: debian apt force overwrite 
C :: dynamic 2d arr in c 
C :: write in file in c 
C :: lewis hamilton 
C :: roll binary c 
C :: grepper vscode 
C :: remove on condtion in vec rust 
C :: c print size_t 
C :: type change in c 
C :: malloc int array c 
C :: Successeur récurssive 
C :: libdvd-pkg: `apt-get check` failed 
C :: 0/1 knapsack problem in c 
C :: arduino millis() 
C :: how to print the first character of a string in c 
C :: how to checkout branch from commit id 
C :: insertion sort c 
C :: goto statement in c 
C :: how to reverse a string in c 
C :: c int to char 
C :: fgets remove newline 
C :: fwrite in c 
C :: delete string function in c 
C :: c programming 
C :: what is c 
C :: terraform fargate cpu 
C :: how to insert elements in and array and print it in c 
C :: Write a C program to multiply two integers using pointers. 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =