getOffset() - $la->getOffset(); // 4️⃣ Convert the difference to hours $diff_hours = $diff_seconds / 3600; // 5️⃣ Get the current timezone abbreviation for Los Angeles (PST or PDT) $la_timezone = $la->format('T'); // Example: "PST" or "PDT" // ----------------------------------------------------------- // Output the results // ----------------------------------------------------------- // Display current time in Seoul echo "현재 한국 시간은 " . $seoul->format('Y-m-d h:i:s A') . " 입니다. (서울)
"; // Display current time in Los Angeles, including PST/PDT label echo "현재 미국 시간은 " . $la->format('Y-m-d h:i:s A') . " 입니다. (로스앤젤레스, {$la_timezone})
"; // Display the time difference and indicate that Korea is ahead echo "한국과 미국({$la_timezone}) 간의 시차는 " . abs($diff_hours) . "시간이며, 한국이 미국보다 " . abs($diff_hours) . "시간 앞서 있습니다.
"; ?> source.txt