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


Top 5 Contributors of the Month
david stephan

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)
        Try
            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))
            Next

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

   End Sub


End Class

   

     

Further Readings:

Responses

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