c# - 将南非时间转换为世界时间

标签 c# datetime timezone

我想将南非时间转换为任何世界时间。我有以下可用值:时区(即布鲁塞尔为 60)和偏移量 = 60。

我已经尝试过这个:

var newDate = DateTime.Now.AddMinutes(60);

但它没有给我布鲁塞尔的正确日期时间值。

最佳答案

您可以使用 DateTime.ToUniversalTime() 将任何 DateTime 转换为通用时间 (UTC) 。由于布鲁塞尔提前一小时,因此增加一小时(如果是夏令时),否则增加两小时。

关于c# - 将南非时间转换为世界时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12277104/

相关文章:

c# - 如何在进程运行期间逐行捕获进程 STDOUT 和 STDERR。 (C#)

c# 将自定义 dll 作为处理器注册到 Printer++ 配置文件

angular - date.getDate 不是函数 Typescript

java - 如果时区设置为 "XXX",SimpleDateFormat 将忽略 "UTC"

html - 确定用户的时区

c# - 检查系统中是否存在 DLL

c# - 按钮上的 onMouseDown 效果

python - 将包含毫秒的日期时间字符串解析为日期时间

python - 类型错误 : '>' not supported between instances of 'datetime.datetime' and 'str'

rust - 通过时区转换 UTC 时间