Sponsored Content
Top Forums Shell Programming and Scripting Calculate the number of days between 2 dates - bash script Post 302611755 by balajesuri on Friday 23rd of March 2012 11:49:29 AM
Old 03-23-2012
Looks alright. What is it that you want to know exactly?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Find number of days and list out the dates in between

Hi All, Can unix cshell list out the number of days between 070201 and 070205 (format is yymmdd) and list out all the dates in between in similiar format. set startdate = `date '+%y%m%d'` #eg 070201 set enddate = `date '+%y%m%d'` #eg 070205 i would expect the number of days to be 5... (2 Replies)
Discussion started by: Raynon
2 Replies

2. UNIX for Advanced & Expert Users

Number of days between two distinct dates

Hi I'm looking for a .ksh script/function that will calculate ONLY the number of days between two distinct dates. Further convert the number of days to weeks and display. I need this to be part of another larger script that checks the password expiry on several servers and notifies the... (1 Reply)
Discussion started by: radheymohan
1 Replies

3. Shell Programming and Scripting

calculate the number of days left in a month

does any one have any ideas how i would go about calculating the number of days left in the month from a bash script ?. I want to do some operations on a csv file according to the result (8 Replies)
Discussion started by: dunryc
8 Replies

4. Shell Programming and Scripting

Script to calculate user's last login to check if > 90 days

I need a script to figure out if a user's last login was 90 days or older. OS=AIX 5.3, shell=Korn Here's what I have so far: ==== #!/usr/bin/ksh NOW=`lsuser -a time_last_login root | awk -F= '{ print $2 }'` (( LAST_LOGIN_TIME = 0 )) (( DIFF = $NOW - $LAST_LOGIN_TIME )) lsuser -a... (3 Replies)
Discussion started by: pdtak
3 Replies

5. Shell Programming and Scripting

Calculate 30/31 days from today date script

Hi Guys, I was working some time ago n was in need to calculate date 30/31 days from today including Feb (Leap yr stuff). Today date is variable depending on day of execution of script. I tried searching but was not able to get exactly what I needed....So at that I time I implemented by my own... (3 Replies)
Discussion started by: coolgoose85
3 Replies

6. Shell Programming and Scripting

Get number of days between given dates

Hi I need one single command to get number of days between two given dates.datecalc is not working. ex. fromdate:01.04.2010 todate :24.04.2010 i should get the out put as 23 Thanks in advance (4 Replies)
Discussion started by: suryanarayana
4 Replies

7. Shell Programming and Scripting

Calculate days between yyyyMmmdd dates on Solaris

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

8. Web Development

Calculate the number of days between 2 dates - PHP

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

9. Shell Programming and Scripting

Shell script to calculate difference between 2 dates

shell script to calculate difference between 2 dates (3 Replies)
Discussion started by: gredpurushottam
3 Replies

10. Shell Programming and Scripting

Get number of days between 2 dates

Gents. Please can u help. I would like to calculate the days between two dates. Example file1 ( previous date) file1 - Input file 9/29/2010 10195 9/29/2010 1057 2/2/2016 10 2/2/2016 10169 2/2/2016 1057 2/3/2016 10005 2/3/2016 10014 In file2 I add the actual date using this code.... (9 Replies)
Discussion started by: jiam912
9 Replies
Math::Symbolic::MiscAlgebra(3pm)			User Contributed Perl Documentation			  Math::Symbolic::MiscAlgebra(3pm)

NAME
Math::Symbolic::MiscAlgebra - Miscellaneous algebra routines like det() SYNOPSIS
use Math::Symbolic qw/:all/; use Math::Symbolic::MiscAlgebra qw/:all/; # not loaded by Math::Symbolic @matrix = (['x*y', 'z*x', 'y*z'],['x', 'z', 'z'],['x', 'x', 'y']); $det = det @matrix; @vector = ('x', 'y', 'z'); $solution = solve_linear(@matrix, @vector); DESCRIPTION
This module provides several subroutines related to algebra such as computing the determinant of quadratic matrices, solving linear equation systems and computation of Bell Polynomials. Please note that the code herein may or may not be refactored into the OO-interface of the Math::Symbolic module in the future. EXPORT None by default. You may choose to have any of the following routines exported to the calling namespace. ':all' tag exports all of the following: det linear_solve bell_polynomial SUBROUTINES
det det() computes the determinant of a matrix of Math::Symbolic trees (or strings that can be parsed as such). First argument must be a literal array: "det @matrix", where @matrix is an n x n matrix. Please note that calculating determinants of matrices using the straightforward Laplace algorithm is a slow (O(n!)) operation. This implementation cannot make use of the various optimizations resulting from the determinant properties since we are dealing with symbolic matrix elements. If you have a matrix of reals, it is strongly suggested that you use Math::MatrixReal or Math::Pari to get the determinant which can be calculated using LR decomposition much faster. On a related note: Calculating the determinant of a 20x20 matrix would take over 77146 years if your Perl could do 1 million calculations per second. Given that we're talking about several method calls per calculation, that's much more than todays computers could do. On the other hand, if you'd be using this straightforward algorithm with numbers only and in C, you might be done in 26 years alright, so please go for the smarter route (better algorithm) instead if you have numbers only. linear_solve Calculates the solutions x (vector) of a linear equation system of the form "Ax = b" with "A" being a matrix, "b" a vector and the solution "x" a vector. Due to implementation limitations, "A" must be a quadratic matrix and "b" must have a dimension that is equivalent to that of "A". Furthermore, the determinant of "A" must be non-zero. The algorithm used is devised from Cramer's Rule and thus inefficient. The preferred algorithm for this task is Gaussian Elimination. If you have a matrix and a vector of real numbers, please consider using either Math::MatrixReal or Math::Pari instead. First argument must be a reference to a matrix (array of arrays) of symbolic terms, second argument must be a reference to a vector (array) of symbolic terms. Strings will be automatically converted to Math::Symbolic trees. Returns a reference to the solution vector. bell_polynomial This functions returns the nth Bell Polynomial. It uses memoization for speed increase. First argument is the n. Second (optional) argument is the variable or variable name to use in the polynomial. Defaults to 'x'. The Bell Polynomial is defined as follows: phi_0 (x) = 1 phi_n+1(x) = x * ( phi_n(x) + partial_derivative( phi_n(x), x ) ) Bell Polynomials are Exponential Polynimals with phi_n(1) = the nth bell number. Please refer to the bell_number() function in the Math::Symbolic::AuxFunctions module for a method of generating these numbers. AUTHOR
Please send feedback, bug reports, and support requests to the Math::Symbolic support mailing list: math-symbolic-support at lists dot sourceforge dot net. Please consider letting us know how you use Math::Symbolic. Thank you. If you're interested in helping with the development or extending the module's functionality, please contact the developers' mailing list: math-symbolic-develop at lists dot sourceforge dot net. List of contributors: Steffen Mueller, symbolic-module at steffen-mueller dot net Stray Toaster, mwk at users dot sourceforge dot net Oliver Ebenhoeh SEE ALSO
New versions of this module can be found on http://steffen-mueller.net or CPAN. The module development takes place on Sourceforge at http://sourceforge.net/projects/math-symbolic/ Math::Symbolic perl v5.10.1 2011-01-01 Math::Symbolic::MiscAlgebra(3pm)
All times are GMT -4. The time now is 12:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy