C# - 根据enetred的位置获取当地时间 [英] C#- get the local time based on the location enetred

查看:145
本文介绍了C# - 根据enetred的位置获取当地时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个assignmnet用户将输入位置名称,它应该将输出作为该位置的当地时间。



例如:如果服务器在英国,我想知道班加罗尔时间,那么一旦我进入班加罗尔时间,它应该给我班加罗尔日期。 />


任何人都可以帮我解决这个问题吗?





问候

Prashant

Hi All,

I have got an assignmnet where users will be entering the location name and it should give the out put as the local time of that location.

For example: If server is in UK and I wanted to know the Bangalore time, So once I enter the bangalore timings it should give me the bangalore date.

Can any one help me how I can proceed on this?


Regards
Prashant

推荐答案

我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



所以从Google开始,看看DateTime和CultureInfo - 你可能会发现ToString重载很方便...
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

So start with Google, and look at DateTime and a CultureInfo - there is a ToString overload that you might find handy...


您需要使用 TimeZoneInfo [ ^ ]课程和可能是一种将位置映射到时区的方法 - 有一些建议 [ ^ ]
You will need to use the TimeZoneInfo[^] class and possible a way of mapping a location to a timezone - there are some suggestions on this post[^]


这篇关于C# - 根据enetred的位置获取当地时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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