.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Sandeep Singh
Melody Anderson
Eminent IT

Home >> Code Snippets >> LINQ >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Query Date with Linq

Posted By:santhiyagu       Posted Date: August 28, 2010    Points: 10    Category: LINQ    URL: http://www.dotnetspark.com  

Query Date with Linq

Query Date with Linq
Imports System.IO
Imports System.Reflection
Imports System.Linq
Imports System.Xml.Linq

Public Class MainClass
   Public Shared Sub Main

        Dim y = Year(Now)
        Dim m = Month(Now)
            Dim MeetingDates(5) As Date
            For i = 0 To UBound(MeetingDates)
                MeetingDates(i) = New Date(y, m, CInt((Date.DaysInMonth(y, m) - 1) * Rnd() + 1))

            Dim CommonDates = From day2 In MeetingDates _
                              Order By day2 _
                              Select day2 Distinct
            For Each d In CommonDates
                Console.WriteLine(Format(d, "MM/dd/yy"))
        Catch ex As Exception
        End Try

   End Sub

End Class



Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend