Difference between revisions of "DateTime compare"

From Catglobe Wiki
Jump to: navigation, search
 
Line 1: Line 1:
[[Category:General_Functions]]
+
{{HelpFiles}}  
{{HelpFiles}}
+
 
 +
<br>
 +
 
 +
==== DateTime_compare  ====
 +
 
 +
Compare 2 datetimes
 +
 
 +
'''Syntax'''
 +
 
 +
DateTime_compare(date1, date1);
 +
 
 +
'''Arguments'''
  
 +
*date1, date2 are arrays which are datetimes to be compared
  
====DateTime_compare====
+
'''Return value'''
  
Compare 2 datetimes
+
number in which:
  
'''Syntax'''
+
*- 1: DateTime_Comparison_Less
 +
*0&nbsp;: DateTime_Comparison_Equal
 +
*1: DateTime_Comparison_Greater
  
DateTime_compare(date1, date1);
+
'''Example'''
  
'''Arguments'''
+
''array datetime1 = DateTime_getByYMD(1985,12,24);''  
  
* date1, date2 are arrays which are datetimes to be compared
+
''array datetime2 = getCurrentDateTime();''
  
'''Return value'''
+
''number result = DateTime_compare(datetime1, datetime2);''  
  
number in which:
+
''if (result == -1)''
  
* - 1: DateTime_Comparison_Less
+
''&nbsp; print("Date time 1 &lt; Date time 2");''
* 0 : DateTime_Comparison_Equal
 
* 1: DateTime_Comparison_Greater
 
  
'''Example'''
+
''else if (result == 0)''  
  
''array datetime1 = DateTime_getByYMD(1985,12,24);''
+
''&nbsp; print("Date time 1 = Date time 2");''  
  
''array datetime2 = getCurrentDateTime();''
+
''else if (result == 1)''  
  
''number result = DateTime_compare(datetime1, datetime2);''
+
''&nbsp; print("Date time 1 &gt; Date time 2");''  
  
''if (result == -1)''
+
''//Date time 1 &lt; Date time 2''  
 
 
''  print("Date time 1 < Date time 2");''
 
 
 
''else if (result == 0)''
 
 
 
''  print("Date time 1 = Date time 2");''
 
 
 
''else if (result == 1)''
 
 
 
''  print("Date time 1 > Date time 2");''
 
  
''//Date time 1 < Date time 2
+
'''Availability'''
  
'''Availability'''
+
Version 5.7 __NOTOC__ <!-- imported from file: 7527.htm-->
  
Version 5.7
+
[[Category:General_Functions]]
__NOTOC__
 
<!-- imported from file: 7527.htm-->
 

Latest revision as of 05:44, 21 December 2011




DateTime_compare

Compare 2 datetimes

Syntax

DateTime_compare(date1, date1);

Arguments

  • date1, date2 are arrays which are datetimes to be compared

Return value

number in which:

  • - 1: DateTime_Comparison_Less
  • 0 : DateTime_Comparison_Equal
  • 1: DateTime_Comparison_Greater

Example

array datetime1 = DateTime_getByYMD(1985,12,24);

array datetime2 = getCurrentDateTime();

number result = DateTime_compare(datetime1, datetime2);

if (result == -1)

  print("Date time 1 < Date time 2");

else if (result == 0)

  print("Date time 1 = Date time 2");

else if (result == 1)

  print("Date time 1 > Date time 2");

//Date time 1 < Date time 2

Availability

Version 5.7