07-25-2008
I thought the same way, with multiple ifs and adjusting the starting date (the closing date is always within the working times) but I thought maybe there is a more effective way to do this.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I extract dates from the log file and need to calculate days between two dates. My dates are in yyyyMmmdd format. Example:
$d1=2011 Oct 21
$d2=2012 Feb 20
I need to calculate the number of days between $d2 and $d1. This is on Solaris.
Any ideas?
Thanks,
djanu (4 Replies)
Discussion started by: djanu
4 Replies
2. Web Development
Is this code good for this purpose?
<?php
$date1 = mktime(0,0,0,01,01,1991);
$date2 = mktime(0,0,0,03,22,2012);
$diff = $date2 - $date1;
$days = $diff / (60*60*24);
echo ($days . "<br />");
?> (3 Replies)
Discussion started by: kovacsakos
3 Replies
3. Shell Programming and Scripting
I wrote the day calculator also in bash. I would like to now, that is it good so?
#!/bin/bash
datum1=`date -d "1991/1/1" "+%s"`
datum2=`date "+%s"`
diff=$(($datum2-$datum1))
days=$(($diff/(60*60*24)))
echo $days
Thanks in advance for your help! (3 Replies)
Discussion started by: kovacsakos
3 Replies
4. Shell Programming and Scripting
I want the difference between two following date using scripts in terms of no.of days. How I can accomplish this.
lastdate=Tue Nov 13 10:30:56 2012
currdate=Wed Dec 15 15:58:21 PAKST 2012
Ouput should be like this:
Your Password will expire after = 32 Days on Wed Dec 15 15:58:21 PAKST... (1 Reply)
Discussion started by: m_raheelahmed
1 Replies
5. Shell Programming and Scripting
shell script to calculate difference between 2 dates (3 Replies)
Discussion started by: gredpurushottam
3 Replies
6. Shell Programming and Scripting
Hi,
how to calculate the time difference between PST date and PDT date in perl scripting.
date1: Mon Dec 31 16:00:01 PST 2015
date2: Tue Mar 19 06:09:30 PDT 2013
and also difference between PST-PST and PDT-PDT
need difference in months or days (months prefereble). (3 Replies)
Discussion started by: praveen265
3 Replies
7. Shell Programming and Scripting
I have to fetch files from a location hour wise.
Eg files available at location /tmp/data/ are
A20140205.1300-1315......
.
.
A20140205.1400-1415......
.
.
A20140205.1700-1715......
.
.
.
.
Below is the code I have prepared.
But it works only for one hour.
For instance... (1 Reply)
Discussion started by: Saidul
1 Replies
8. UNIX for Advanced & Expert Users
Hello,
I have a question please,
How could I get ALL update dates and hours of a file ?
For example:
I modified a file on 09/04/2014 at 7:am for the first time. Then, I modified again the same file on 09/04/2014 at 9 am and finally, I modified the same file again on 10/04/2014 at... (3 Replies)
Discussion started by: nurinolo
3 Replies
9. Shell Programming and Scripting
I have two dates in below format, how would I find the hours difference between the two dates. Im using AIX and ksh.
Current date : Wed May 17 14:34:41 SGT 2017
File date : Thu Apr 27 20:52:41 SGT 2017 (3 Replies)
Discussion started by: simpltyansh
3 Replies
10. Red Hat
Objective: We have multiple files in a folder and we want to delete all files except for last 1 week files.
Note: We are copying these files from original location to this temporary location. So time shown for these files are time when we copied to this location. Not that when file was created.... (2 Replies)
Discussion started by: Agoyals1986
2 Replies