且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

字符串到DateTime的转换

更新时间:2023-02-03 09:07:48

^ ]方法或其他任何Parse()方法.
Start with the DateTime.TryParse()[^] method, or any of the other Parse() methods.


分析提出上述问题的可行性?

在问题的正文中,有122 个字符(不带空格),

(假设)
如果每个字符都需要.1秒来键入,那么它将出现在.1x122=12.2 seconds上.

问题本身是26 个字符(,没有任何空格),因此将是.1x26 = 2.6 seconds.

根据互联网速度和对Codeproject的问问题"部分的熟悉程度,我认为还需要另外1分钟来提交问题(OP).

首先,使用代码项目的问题回答时间频率的基本假设(不使用任何预测或学习算法来计算时间频率),我假设它将花费至少(至少)5分钟的时间得到答案.

所以一起出现在5mins + 12.2 seconds + 2.6 seconds = 5mins 14.8 seconds.

我在 www.google.com [ ^ ]网站,它将显示.39 seconds中的12,900,000结果(取决于我的互联网速度)

我仍然相信这将节省OP的大量时间,并提高他们的研究技能,以找到问题的解决方案.
Analysis of the feasibility of asking the above Question?

In the body of the questions there are 122 characters (without any spaces),

(Assume)
If each character take .1 seconds to type so that will come up .1x122=12.2 seconds.

The question itself 26 characters (without any spaces) so that will be .1x26 = 2.6 seconds.

And Depending the internet speed and familiarity of the Codeproject’s ask a questions section, I would assume it will take another 1 mins to submit the questions (OP).

On top using the based assumption (without using any prediction or learning algorithm for calculating the time frequency) of the Codeproject’s question answer time frequency I would assume it will take another (at least) 5 mins to get a answer back.

So it comes up al together 5mins + 12.2 seconds + 2.6 seconds = 5mins 14.8 seconds.

Where as while I type the question in the www.google.com[^] website it will come up the 12,900,000 results within .39 seconds (depending on my internet speed)

Still I would believe this will save OP’s lots of time and as well as improve their research skills to find out the solution for a problem.


如果您从数据库中获取日期,则可以使用以上在存储过程中查询

此链接将为您提供有关日期时间格式的更多信息...
http://www.technoreader.com/SQL-Server-Date-Time-Format.aspx [ ^ ]
或者您可以使用此ShorDateTime函数
If You are getting Date From Database You can use the above Query in stored procedure

This link Wil give You More Info About Date Time Formatting...
http://www.technoreader.com/SQL-Server-Date-Time-Format.aspx[^]
or You can use this ShorDateTime Function
string to_date2;
to_date2 = DateTime.Now.ToShortDateString();
DateTime today;
today = DateTime.Parse(to_date2);
string to_day;
to_day = today.ToString(("yyyy-MM-dd"));