以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]GetValues获取日期列不重复的年或月  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=43274)

--  作者:pcxjxjhkw
--  发布时间:2013/12/3 15:45:00
--  [求助]GetValues获取日期列不重复的年或月

表A中有一日期列,如何用GetValues获取该列不重复的年或月?

如:日期列已录入下列值:  2012-03-05    2013-02-08,2012-02-23.。。。。。。。。。。

GetValues获取年集合2012,2013

 


--  作者:Bin
--  发布时间:2013/12/3 15:56:00
--  
循环获得的年月集合来生成一个新集合

Dim dList As List(of String)
Dim ylist As new List(of String)
For Each d As String In dList
   If ylist.Contains(d.Substring(0,4))=False Then
     ylist.Add(d.Substring(0,4)
   End If
Next

--  作者:pcxjxjhkw
--  发布时间:2013/12/3 16:18:00
--  
谢谢,解决了