转换服务器UTC时间到客户端的本地时间 [英] Convert server UTC time to client local time

查看:164
本文介绍了转换服务器UTC时间到客户端的本地时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从服务器本机(C ++)申请获得UTC格式的FILETIME结构。在管理(C#)客户端我需要将其显示为客户端(!)本地时间。我需要以及有关服务器时区FILETIME传递信息以做到这一点?或者这些信息已经包含在FILETIME UTC格式?

I get from server native (C++) application a FILETIME structure in UTC format. On the managed (C#) client side I need to show it as client(!) local time. Do I need along with FILETIME transfer information about server time zone to accomplish this? Or such information already contains in FILETIME in UTC format?

推荐答案

您可以使用的TimeZoneInfo

TimeZoneInfo.ConvertTimeFromUtc(YourDateTime, TimeZoneInfo.Local);

您可以将UTC日期时间转换为任何时区,如果你知道这个名字。例如

You can convert a UTC DateTime to any timezone, if you know the name. For example.

TimeZoneInfo.ConvertTimeFromUtc(YourDateTime, 
                TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time"));



更多信息




  • 的TimeZoneInfo类

  • 如何:实例化一个对象的TimeZoneInfo

  • More Information

    • TimeZoneInfo Class
    • How to: Instantiate a TimeZoneInfo Object
    • 这篇关于转换服务器UTC时间到客户端的本地时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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