需要有关设置日期时间格式的帮助 [英] Need help regarding setting the datetime format

查看:82
本文介绍了需要有关设置日期时间格式的帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



请在这需要帮助。



在我的申请中,有一些东西称为用户设置,他可以根据需要选择应用程序设置。

所以我也有日期格式。



所以每个用户可以选择不同的日期格式。但SQL Server只采用一种格式。



现在我想要的是假设用户选择日期格式为YYYY / DD / MM,在应用程序中它应该以相同的方式显示日期格式,但在保存在数据库中时它应该以sql自己的格式保存。



请告诉我如何要做到这一点..

Hi all

Please need help in this.

In my application, there is something called user-settings where he can select application settings according to his need.
So i have date format also in that.

So every user can select different different date format.but SQL Server will take only one format.

Now what i want is suppose the user selects the date format as YYYY/DD/MM, in the application it should show the date format in the same way, but while saving in database it should get saved in sql's own format.

Please tell me how to do this..

推荐答案

这样做的方法是在内部的每个地方以一致的方式存储日期,并且唯一的地方应该更改为其他内容是在UI上显示内容或从UI上的用户输入中读取内容时。



用户首选项应定义如何显示内容,而不是如何在内部存储。
The way to do this is to store the date in a consistent manner everywhere internally, and the only place that it should change to something else is when displaying something on the UI or reading it back from user input on the UI.

User preferences should define how something is displayed, not how it is stored internally.


请参阅这个。 也许可以帮到你。
please see this. maybe helps you.


这篇关于需要有关设置日期时间格式的帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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