Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Comparing two dates 1

Status
Not open for further replies.

mitch77

Programmer
Nov 16, 2000
42
PT
Hi,
Does Anyone knows, the method to compare two dates??

Thanks, Mitch

 
this is a javascript function for that. You could probably easily modify it for vbscript. all it does it take two parameters (dates, numbers, strings, whatever) and return the large one. There's probably a lot more that could go into this

<script language=javascript>

function compare(o1,o2)
{
if(o1>o2){ return o1 }
else if(o2>o1) { return o2 }
else { return &quot;equal&quot; }
}

//heres how you use it mitch
d=new Date(&quot;11/12/2000&quot;)
e=new Date(&quot;05/11/2001&quot;)
x=compare(d,e)

</script>
jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top