#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main() {
// Set the timezone to London
setenv("TZ", "Europe/London", 1);
tzset();
// Get the current time
time_t now = time(NULL);
struct tm *local = localtime(&now);
printf("Current date and time in London: %02d-%02d-%04d %02d:%02d:%02d\n",
local->tm_mday, local->tm_mon + 1, local->tm_year + 1900,
local->tm_hour, local->tm_min, local->tm_sec);
return 0;
}
/*
run:
Current date and time in London: 27-02-2025 07:45:34
*/