Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to sort different dates in and get the Max date from those
#3
Not Solved
Please use DotNetFactory object to simplify this.

Here i assume that you get the dates from the application and store it in an array
Code:
Dim arr(3)
arr(0) = "Thursday, September 13, 2012"
arr(1) = "Saturday, September 08, 2012"
arr(2) = "Friday, December 14, 2012"
arr(3) = "Friday, November 23, 2012"

This is the part sorts the date and gives you the max date in the required format

Code:
Set SystemDateTime = DotNetFactory.CreateInstance( "System.DateTime" )
Set ArrayList = DotNetFactory.CreateInstance( "System.Collections.ArrayList")
For i =0 To 3
    Set DateTime = SystemDateTime.Parse(arr(i))
    ArrayList.Add DateTime
Next
ArrayList.Sort
ArrayList.Reverse

Print "Result=" &ArrayList.item(0).GetDateTimeFormats().GetValue(7)
Reply


Messages In This Thread
RE: How to sort different dates in and get the Max date from those - by vIns - 09-07-2012, 07:35 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to validate date in an application should not accept less than future date. ruchi03 1 3,636 10-08-2014, 05:54 PM
Last Post: rajkumarsm
  Date Picker Issue - Unable to select date link dynamically rajkumarsm 1 5,164 09-20-2014, 09:31 AM
Last Post: rajkumarsm
  Custom sort -Excel Sheet kiran 1 3,857 01-28-2014, 09:23 AM
Last Post: supputuri
  Date Format needs adjustment unbeliever 2 3,357 01-15-2010, 03:04 PM
Last Post: sreekanth chilam
  Verifying the sort function mahadevan.swamy 1 7,191 11-14-2008, 01:49 PM
Last Post: hieutue

Forum Jump:


Users browsing this thread: 1 Guest(s)