<?php
// Include necessary files
include 'db.php';

// Set content type
header('Content-Type: text/plain');

// Get timezone parameter
$timezone = $_GET['timezone'] ?? 'Asia/Karachi';

// Validate timezone
if (!in_array($timezone, DateTimeZone::listIdentifiers())) {
    echo 'Invalid timezone';
    exit;
}

try {
    // Get current time in specified timezone
    $date = new DateTime('now', new DateTimeZone($timezone));
    echo $date->format('Y-m-d H:i:s T');
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}
?> 