Date format in C


/ Published in: C



Copy this code and paste it in your HTML
  1. #import <time.h>
  2. time_t currentTime = time(NULL);
  3. struct tm timeStruct;
  4. localtime_r(&currentTime, &timeStruct);
  5. char buffer[20];
  6. strftime(buffer, 20, "%d-%m-%Y %H:%M", &timeStruct);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.