Set Time
Tagged with: command, date, Linux, set, time
Tuesday, July 15th, 2008 11:12 PM
Set date and time - MonthDayhoursMinutesYear.Seconds
date 041217002007.00
Set date and time - MonthDayhoursMinutesYear.Seconds
date 041217002007.00
Search files created or changed within 10 days
find /usr/bin -type f -mtime -10
Start a download at any given time
echo 'wget -c www.example.com/files.iso' | at 09:00
I run this command when I go for lunch or something - these commands take a while to run.
sudo /bin/bash /usr/sbin/makewhatis -w; sudo /usr/bin/updatedb; sudo /home/binnyva/Software/System/chkrootkit-0.47/chkrootkit
Create the MySQL format date(YYYY-MM-DD) using the date command
date +%Y-%m-%d
This function will find the difference between two given times. Does PHP already have a native function for that?
//The difference between 2 given time
function dateDifference($day_1,$day_2) {
$diff = strtotime($day_1) - strtotime($day_2);
$sec = $diff % 60;
$diff = intval($diff / 60);
$min = $diff % 60;
$diff = intval($diff / 60);
$hours = $diff % 24;
$days = intval($diff / 24);
return array($sec,$min,$hours,$days);
}
If you just want the day difference…
$diff = strtotime($day_1) - strtotime($day_2) + 1; //Find the number of seconds
$day_difference = ceil($diff / (60*60*24)) ; //Find how many days that is
This can be done using the DATEDIFF function in MySQL 5
[tags]php,code,date,difference,time[/tags]