转换时区 [英] Convert Time zones

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

问题描述

您好!我正在尝试构建一个Visual Basic表单,允许我将时区从一个国家/地区转换为另一个国家/地区。例如,英国到美国。我期待添加所有时区。 

Hello! I'm trying to build a Visual Basic form that allows me to convert time zone from a country to another country. For example, the United Kingdom to the United States. I'm looking forward adding all the time zones. 

所以基本上我需要输入 date &
<时间 时区#1  并点击
按钮加下划线,将其转换为文本框或其他日历时区#2 。这很简单,但我找不到建立这种形式的方法。请帮助。

So basically I need to enter the date & time of time zone #1 and click on a button that converts it to a textbox or another calendar with time zone #2. That simple, but I cannot find a way to build this form. Please help.

编辑#1:我正在使用Visual Studio Professional 2017。

Edit#1: I'm using Visual Studio Professional 2017.

谢谢。

推荐答案

这可以简单到减去时区或更复杂,具体取决于已知的细节。

This can be as simple as subtracting the time zones or more complex depending on the known details.

要转换为utc,您可以使用date1. ToUniversalTime
其中date1是日期数据类型。

To convert to utc you can use date1.ToUniversalTime where date1 is a date data type.

您知道国家和时区吗?你知道什么,你期望表格做什么?即用户输入什么以及将输出什么结果。

Do you know the country and time zone already? What do you know and what are you expecting the form to do exactly? ie what will the user input and what result will be output.

最后,应考虑是否需要对闰年等事项进行详细调整,具体取决于您要考虑的时间长度。

Finally one should consider if detailed adjustments are desired for things like leap years depending on the length of time periods you want to consider.


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

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