473,230 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,230 software developers and data experts.

how to find the greatest date in a arry

145 100+
hi to all
iam having dates in array (dd/mm/yy)
i need to find the greatest date value from the array
array(1) = 01/01/2003
array(2) = 01/03/2003
array(3) = 01/05/2003
array(4) = 02/02/2004
array(5) = 01/01/2003
array(6) = 03/04/2008

the highest value is 03/04/2008

can any one help me
its vvvery urgent
Jun 24 '08 #1
2 1216
1,295 Expert 1GB

make the array a DATE array, then you can use (depending on the version) a math.max() function, or create it by yourself, e.g.

Expand|Select|Wrap|Line Numbers
  1. dim arr1(1 to 10) as date
  2. 'here's the code where you fill the dates into the array
  3. dim i as integer
  4. dim tmp1 as date
  6. tmp1=arr1(1)
  7. for i = 2 to 10
  8.     if arr1(i) > tmp1 then tmp1=arr1(i)
  9. next
  10. msgbox tmp1
Jun 24 '08 #2
if youre using proper date objects, try sorting ascending, and the last item is your highest:

Expand|Select|Wrap|Line Numbers
  1. ' sort the date array
  2. Array.Sort(dates)
  4. ' your highest date will be:
  5. dates(dates.GetUpperBound(0))
  7. ' your lowest date will be:
  8. dates(0)
Jun 25 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

by: Gleep | last post by:
sorry i didn't explain it correctly before my table is like this example fields: ID name username outcome date1 date2 date3 (etc..) - date15 price1 price2 price3 (etc..) I know that...
by: zaceti | last post by:
I'm new to MySQL and I am having a problem selecting the highest valued date/time for a particular day. Here is the table structure: ...
by: Mike Nolan | last post by:
As far as I can tell, Postgres has no equivalent to greatest and least functions in Oracle. Yes, you can do the same thing with a case statement, but at the expense of writing MUCH longer SQL...
by: Mathew Butler | last post by:
Suppose I have a table t with columns id, col1, col2, col3, col4, col5, col6 all numeric. I want to query the table and for each value of col<x> in the resultset I want to identify the largest value...
by: abfab | last post by:
Hello, I'm new to VB, and I realy don't get the arrays. I have to write a program that takes an arry of string as a parameter and adds "sir" to each string. I need to use "get upper bound." Can...
by: BB | last post by:
Here is my SQL statement SELECT a.name, b.meterno, c.meterstatus, d.accountno, d.creation_date FROM fmdata.location a, cisdata.service_meters b, cisdata.meter_master c, cisdata.Account_Master d...
by: Grey | last post by:
I have following problem: table includes times for startup and end of operation as datetime field related to daily shift operations: dateid date starttime endtime 458 2006-12-29 22:00 ...
by: sdlt85 | last post by:
Hi, Can someone help me with an idea on how to start writing a C++ code for generating greatest common divisor and the linear combination of two intergers represented as gcd(m, n)= mx + ny and...
by: stressedstudent | last post by:
I dont know where I am going wrong so I dont know which part to post, this is what I have, can anyone help me figure out where I am going wrong? THanks for any and all help. // into to c++ //...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.