Form1.cs
using System;
using System.Windows.Forms;
namespace TimeDifference
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Timer1_Tick(object sender, EventArgs e)
{
var jpnow = DateTimeOffset.Now;
textBoxJpNow.Text = jpnow.DateTime.ToString("yyyy/MM/dd HH:mm:ss");
DateTimeOffset USA = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(jpnow, "Pacific Standard Time");
textBoxUSA.Text = USA.DateTime.ToString("yyyy/MM/dd HH:mm:ss");
textBoxUSADif.Text = (USA.DateTime - jpnow.DateTime).ToString();
TimeZoneInfo USATimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time");
textBoxUSAStName.Text = USATimeZoneInfo.StandardName;
}
}
}