mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 02:40:05 +00:00
Add misc\get-date.c
Prints the current date as YYYYMMDD without relying on PowerShell. Hopefully fixes #4540
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
/*
|
||||
Prints the current date as YYYYMMDD
|
||||
|
||||
e.g. 2024-12-25
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
|
||||
int main(int arg_count, char const **arg_ptr) {
|
||||
time_t t = time(NULL);
|
||||
struct tm* now = localtime(&t);
|
||||
printf("%04d%02d%02d", now->tm_year + 1900, now->tm_mon + 1, now->tm_mday);
|
||||
}
|
||||
Reference in New Issue
Block a user