Re: Comparing time in Linux



Josef Moellers wrote:
Binary wrote:
Hi,

Any command or script to compare the date/time in Linux? I want to know
a date is later or ealier than another. Such as 2005/10/10 >
2004/11/21?
char *date1 = "2004/11/21";
char *date2 = "2005/10/10";
int ret = strcmp(date1,date2);
if(ret < 0) {
	date1 is before date2
else if(ret > 0) {
	date1 is after date2
} else
	they're the same date

Think about why for this date format,
and wether you might encount possible locale/charset problems.
.



Relevant Pages