C#同步不同的时区 [英] C# Synchronizing different time zones

查看:156
本文介绍了C#同步不同的时区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个基于英国的服务器上有一个应用程序。

I have an application on a server which is UK based.

说我需要同时为不同的国家运行应用程序。为了说明理由,我希望在不同的国家/地区的时间是晚上7点,我需要一个电子邮件发送到邮箱。

Say I needed the application to run at the same time for different countries. For arguments sake say I needed it to send an email to a mailbox whenever the time is 7pm in various countries.

我如何才能实现这一点?目前我只是在特定时间从任务计划程序运行(对于英国的客户端来说这是适用的)。但是,我想支持国际。

How would I be able to achieve this? At the moment I just have it running from the Task Scheduler at the specific time (which is fine for UK based clients). However, I would like to support internationally.

谢谢。

推荐答案

将日期/时间存储为 UTC ,然后计算时间对于每个地点的时区。

Store date/times as UTC, and then compute time for each locations's time zone.

Plesae看到: C# - 将UTC / GMT时间转换为当地时间

Plesae see: C# - Convert UTC/GMT time to local time

这篇关于C#同步不同的时区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆