date_compare_datetime

Returns which of two times on specific dates is the latest.

Syntax:

GML Code Example

date_compare_datetime(date1, date2);


Argument Description
date1 The first datetime.
date2 The datetime to compare it to.


Returns: Real


Description

With this function you can check two dates and times to see which one is the earlier or later than the other. The function returns -1 if date1 is earlier, 1 if date1 is later and 0 if they are the same, although since this takes time into account as well, a 0 for matching is very rare (it literally has to be the same second of the same day of the same month of the same year to return a 0).


Example:

GML Code Example

d = date_compare_date(date_create_datetime( 2011, 9, 15, 11, 4, 0 ), date_current_datetime());

This would set d to the corresponding value depending on which of the datetimes was the earliest, likely -1 since the current date would be further ahead than 15th September 2011.





No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here