本文介绍了如何减去给定的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

您能帮助我如何从给定的整数中减去"MM/DD/YYYY"格式的给定日期吗?

请帮我....

在此先感谢...

Hi Guys,

Can you help me in how to Subtract a given date from an given integer with a format of a "MM/DD/YYYY"?

Please help me ....

Thanks in Advance...

推荐答案

jleonorlane写道:
jleonorlane wrote:

减去给定日期来自给定的整数

Subtract a given date from an given integer



如何从整数中减去日期?两者都是完全不同的数据类型.

看起来您想减去给定日期的整数天数,如果是这样,请执行以下操作:
myDate.AddDays(-1*numberToDeduct);

将日期转换为特定格式,例如:
(Convert.ToDateTime(myDate)).ToString("MM/dd/yyyy");



How come a date can be substracted from an integer? Both are totally different datatypes.

Looks like you want to substract integer number of days from a given date, if so, do something like:
myDate.AddDays(-1*numberToDeduct);

Converting date in a particular format, do like:
(Convert.ToDateTime(myDate)).ToString("MM/dd/yyyy");


Dim x As New Date
Dim i As Integer = 0
Dim xdays = TimeSpan.FromDays(x.TimeOfDay.Days)
Dim idays = TimeSpan.FromDays(i)
Dim diff = (xdays - idays)



这篇关于如何减去给定的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 05:18