diff options
| author | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2024-12-03 12:42:13 +0100 |
|---|---|---|
| committer | Jeroen van Rijn <Kelimion@users.noreply.github.com> | 2024-12-03 12:42:13 +0100 |
| commit | ef5546aea521d806dcdb5a6f3fd15481ae8e9a6e (patch) | |
| tree | 17e62774f732c7f33559609c0e11cce5d24fc8cd /misc | |
| parent | b94247988658f875bfaed6717b3f888d75d5e660 (diff) | |
Add misc\get-date.c
Prints the current date as YYYYMMDD without relying on PowerShell.
Hopefully fixes #4540
Diffstat (limited to 'misc')
| -rw-r--r-- | misc/get-date.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/misc/get-date.c b/misc/get-date.c new file mode 100644 index 000000000..bf5b32738 --- /dev/null +++ b/misc/get-date.c @@ -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); +}
\ No newline at end of file |