![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Get date from cal function | ukatru | UNIX for Advanced & Expert Users | 3 | 09-04-2008 05:54 AM |
| Friendz.. plz help me on this date function. | psn123 | UNIX for Advanced & Expert Users | 14 | 07-23-2008 04:09 PM |
| Date Function | charandevu | Shell Programming and Scripting | 1 | 04-02-2008 09:12 AM |
| Date Function | charandevu | Shell Programming and Scripting | 1 | 04-02-2008 07:44 AM |
| date function | abey | Shell Programming and Scripting | 2 | 02-27-2006 05:28 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Date function
I read man page for etc/shadow field..
on the 8th field, i assume that's the field to change account expire date. my question is: What value does the 8th field keep? i assume it's 13514 instead of "Date" value such as 11/10/08. on the man page, it said: " expire value = 13514 = jan 1, 2007" How do you get 13514 ? Is there any calculation involves? |
|
||||
|
You should read man date for your *NIX, this solution should work on Linux date (GNU coreutils) 5.97
Code:
dt=1/1/07 # For January 1, 2007 # dt=$(date "+%d/%m%y") # For current date var=$(($(date -d $dt "+%s") / 86400)) echo $var 13514 |
|
||||
|
i made some syntax modification which are:
#old=1/1/07 old=`date +%d%m%y` var="(`(date -u $old "+%s")`/ 86400)" echo $var but i have a problme with the third line.. when i read man page for date, it only supports usage: date [-u] mmddHHMM[[cc]yy][.SS] date [-u] [+format] date -a [-]sss[.fff] i'm guessing i should use -u but i think it's wrong Last edited by c00kie88; 10-11-2008 at 07:53 AM.. |
|
||||
|
What OS? and where you perform the calculation?
|
| Sponsored Links | ||
|
|