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
#1
Not Solved
Hi all,

Have an urgent requirement.

There is webtable, where in the 6 th column we are having our dates, and those can be any dates.

date format :Thursday, September 13, 2012 (Row 1)
Saturday, September 08, 2012 (Row 2)
Friday, September 07, 2012 (Row 3)
Friday, November 23, 2012 (Row 4)

Now we need to found the max date from these dates.
say here novemmber date. Should be a generalized one.

Thanks In advance,

Nilanjan.
Reply
#2
Not Solved
Hello

First find out row count and then start compare each month using IF condition.

Code:
if month = December then
split that month with dates and compare with each December date.
and exist...
Start with December month and start with 31 date.

You want to compare and find highest date ?. You can do using Loop. run loop and change each time value and compare the value.

It is more VB programming part.
Reply
#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


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,163 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,353 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)