Linux How To Compare the timestamp
1) Using Date command we can compare
2) In these format i used just simple numberical comparsion and it'wll work for timestamp comparsion.
Year-Month-day-Hour-Minute-second.
3)syntax
Date1=`date +%Y%m%d%H%m%S`;
Date2=`date +%Y%m%d%H%m%S`;
if(Date1 Condition Date2)
date +
%y - Year in Two Digit
%Y - year in Four Digit
%m - month in Numberic
%d - Date
%H- Hours
%h - Month in String
For Example
current_time=`date +%Y%m%d%H%M%S`;
Year-Month-Date-Hour- Minute-Second
if [ "$login_time" -lt "$current_time" ]; then
How To Compare Time stamp in Shell Script.
1) Using Date command we can compare
2) In these format i used just simple numberical comparsion and it'wll work for timestamp comparsion.
Year-Month-day-Hour-Minute-second.
3)syntax
Date1=`date +%Y%m%d%H%m%S`;
Date2=`date +%Y%m%d%H%m%S`;
if(Date1 Condition Date2)
date +
%y - Year in Two Digit
%Y - year in Four Digit
%m - month in Numberic
%d - Date
%H- Hours
%h - Month in String
For Example
current_time=`date +%Y%m%d%H%M%S`;
Year-Month-Date-Hour- Minute-Second
if [ "$login_time" -lt "$current_time" ]; then
How To Compare Time stamp in Shell Script.
0 comments:
Post a Comment