如何在vb.net中获取两个日期之间的日期 [英] How to get the dates between two dates in vb.net
本文介绍了如何在vb.net中获取两个日期之间的日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在vb.net中获取两个日期之间的日期名称.
前-Fromdate(2012年7月16日)
至今(7/22/2012)
输出
2012年7月16日
2012年7月17日
2012年7月18日
2012年7月19日
2012年7月20日
2012年7月21日
2012年7月22日
就是这样..
我需要将这些日期分配到文本框中...
在此先感谢
Sucharitha
Hi,
How to get the days names between two dates in vb.net.
Ex- Fromdate(7/16/2012)
Todate(7/22/2012)
OutPut
7/16/2012
7/17/2012
7/18/2012
7/19/2012
7/20/2012
7/21/2012
7/22/2012
Like that..
I need to assign those dates into textboxes...
Thanks in advance
Sucharitha
推荐答案
尝试一下:
Try this:
Dim startDay As Date
Dim endDay As Date
startDay = New Date(2012, 7, 16)
endDay = New Date(2012, 7, 22)
Dim dayCtr As Date
dayCtr = startDay
Do While (dayCtr <= endDay)
MessageBox.Show(dayCtr.Date.Day & "-" & dayCtr.Date.DayOfWeek.ToString())
dayCtr = dayCtr.AddDays(1)
Loop
任何人都可以给我代码
不,它在这里不能这样工作.
这是询问者的期望:
1. 先尝试您要做什么!您可能会发现它并不难.
2.制定看起来像问题/无法解决的问题.
试试看,告诉他们是否遇到问题.
成员将很乐意为您提供帮助.
阅读有关:DateTime结构公开的DayofWeek
属性.
参考:
DateTime.DayOfWeek属性 [ MSDN:DateTime结构 [
Please can any body give me the code
No. It does not work like this here.
Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it''s not that hard.
2. Formulate what was done by you that looks like an issue/not working.
Try them and tell if you face issues.
Members will be more than happy to help like this.
Read about:DayofWeek
property exposed by DateTime structure.
Refer:
DateTime.DayOfWeek Property[^]
MSDN: DateTime Structure[^]
请可以使用任何正文给我代码
不,它在这里不能这样工作.
这是询问者的期望:
1. 先尝试您要做什么!您可能会发现它并不难.
2.制定看起来像问题/无法解决的问题.
试试看,告诉他们是否遇到问题.
成员将很乐意为您提供帮助.
阅读有关:DateTime结构公开的DayOfWeek
属性.
参考:
DateTime.DayOfWeek属性 [ MSDN:DateTime结构 [
Please can any body give me the code
No. It does not work like this here.
Here is what is expected of enquirers:
1. TRY first what you want to do! You may find that it''s not that hard.
2. Formulate what was done by you that looks like an issue/not working.
Try them and tell if you face issues.
Members will be more than happy to help like this.
Read about:DayOfWeek
property exposed by DateTime structure.
Refer:
DateTime.DayOfWeek Property[^]
MSDN: DateTime Structure[^]
这篇关于如何在vb.net中获取两个日期之间的日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文