Azure Website - UTC Time and Local Time
2015-11-24 17:39
337 查看
Key: Azure Website uses UTC time on the server
How to: show local time in website UI?
Solution:
#1 Use TimeZoneInfo to convert UTC to local time
var cetZone = TimeZoneInfo.FindSystemTimeZoneById("Central Europe Standard Time");
in app settings, add the TimeZoneInfo Id value to the WEBSITE_TIME_ZONE attribute, then, the DateTime.Now() method will return local time instead of the default GMT
reference - http://blogs.msdn.com/b/waws/archive/2014/08/05/get-the-local-server-time-for-your-azure-web-site.aspx
How to: show local time in website UI?
Solution:
#1 Use TimeZoneInfo to convert UTC to local time
var cetZone = TimeZoneInfo.FindSystemTimeZoneById("Central Europe Standard Time");
var localTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, cetZone);#2 Use app settings to always show local time in Azure Management
in app settings, add the TimeZoneInfo Id value to the WEBSITE_TIME_ZONE attribute, then, the DateTime.Now() method will return local time instead of the default GMT
reference - http://blogs.msdn.com/b/waws/archive/2014/08/05/get-the-local-server-time-for-your-azure-web-site.aspx
相关文章推荐
- 【计算机网络】:tcp报文详解
- 子线程和主线程业务依次执行循环50次
- 同步调用、回调和异步调用区别
- iOS 官方文档 UIView
- Insert select 和 update select 操作
- SpringMVC+Spring+Hibernate的小例子
- bootstrap, boosting, bagging 几种方法的联系
- 第三方开源水面波浪波形view:WaveView
- iOS学习笔记--04 NSUserDefaults
- 模板类成员函数的定义和声明为什么要放在一个文件中
- Activity从左进入
- Ubuntu 下SVN服务器的搭建
- Windows环境下Android Studio v1.0安装教程、快捷方式
- <3>Android HAL如何向上层提供接口总结
- PHP中使用sleep函数实现定时任务实例
- C#跳转语句
- 浏览器间bug
- sun.misc.BASE64加解密跟Apache的commons-codec加解密区别以及改造兼容Apache
- [Java语言] JDBC: 批量处理提高SQL处理速度
- poj 2352 Stars(树状数组)