Re: Comparing time in Linux
- From: "Nils O. Selåsdal" <NOS@xxxxxxx>
- Date: Fri, 23 Dec 2005 11:10:07 +0100
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
- Re: Date Interval Functions
... DateDiff(interval, date1, date2 ]) ... You can use the DateDiff function to determine how many specified time ... (microsoft.public.inetserver.asp.general) - Re: HP COBOL routine to calculate the difference between 2 dates
... 05 d1mm pic 99. ... move 'x' to date1 ... no advancing accept date2 display date2 ... (comp.sys.hp.mpe) - Re: Excel 2003 - Help writing a formula to get time (w, d, h, m)
... Function YMWD(ByVal Date1 As Variant, ByVal Date2 As Variant) As String ... Dim NumOfMonths As Long ... NumOfDays = Abs) ... (microsoft.public.excel.worksheet.functions) - Re: Excel 2003 - Help writing a formula to get time (w, d, h, m)
... Most of the time, the amount of time is less than a week, however in some ... Function YMWD(ByVal Date1 As Variant, ByVal Date2 As Variant) As String ... NumOfDays = Abs) ... (microsoft.public.excel.worksheet.functions) - Re: To work out how many days, weeks, months to I retire on 20 Sep 201
... Press Alt+F11 to go to the VB editor, click Insert/Module from its menu bar, then copy paste the following UDF into the code window that opened up... ... Function YMWD(ByVal Date1 As Variant, ByVal Date2 As Variant) As String ... NumOfDays = Abs) ... (microsoft.public.excel.worksheet.functions) |
|