如何在metro风格的应用程序中获取指定Timezone的datetime表单? [英] How to get datetime form specified Timezone in metro style apps?

查看:60
本文介绍了如何在metro风格的应用程序中获取指定Timezone的datetime表单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请您告诉我,如何在metro风格应用中获取指定时区的日期时间


来自msdn的线程响应

Could you please tell me, How to get datetime form specified Timezone in metro style apps


Thread response from msdn

推荐答案

Hai friends此代码适用于.net 4.0如何在metro风格的应用中使用。在TimeZoneInfo类中,在metro风格的应用程序中没有FindSystemTimeZoneById方法。

Hai friends This code works on .net 4.0 how to approach in metro style apps. In TimeZoneInfo class doesn't have a FindSystemTimeZoneById method in metro style apps.

string ZoneId = "Central America";
DateTime localtime = DateTime.Now;
TimeZoneInfo timeZoneInfo = System.TimeZoneInfo.FindSystemTimeZoneById(ZoneId);
DateTime dataTimeByZoneId = System.TimeZoneInfo.ConvertTime(localtime, System.TimeZoneInfo.Local, timeZoneInfo);
return dataTimeByZoneId;





这篇关于如何在metro风格的应用程序中获取指定Timezone的datetime表单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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