The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
Google UNIX.COM


UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Date Question DKNUCKLES Shell Programming and Scripting 2 10-21-2007 04:44 PM
Date Scripting Question BigDawg32 Shell Programming and Scripting 6 10-19-2006 09:40 AM
Date question 12yearold Shell Programming and Scripting 1 07-25-2006 10:46 PM
Date question dsimpg1 AIX 1 12-02-2005 09:40 AM
date question rdeschene3 Shell Programming and Scripting 3 06-01-2005 04:46 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-11-2002
Registered User
 

Join Date: Mar 2002
Posts: 3
Question date question

hi,

how do i get the last day of the current date or a given date using unix.

for e.g. if i run the command/script on 1st feb 2002 i should get 28 th feb 2002.

thanks !!
AnkuR.
Forum Sponsor
  #2 (permalink)  
Old 03-11-2002
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,352
I have just revised my datecalc script to add this function. Click here for datecalc.
  #3 (permalink)  
Old 03-13-2002
Registered User
 

Join Date: Feb 2002
Location: www.freebsdforums.org
Posts: 67
Quote:
Originally posted by Perderabo
I have just revised my datecalc script to add this function. Click here for datecalc.
Nice! I would also suggest using Perl so that the function/module can be readily called directly from other scripts.
__________________
FreeBSD: The best free Unix on this planet IMHO!!

FreeBSD Forums
www.freebsdforums.org
  #4 (permalink)  
Old 03-13-2002
PxT's Avatar
PxT PxT is offline
Registered User
 

Join Date: Oct 2000
Location: Sacramento, CA
Posts: 905
Just like everything else in Unix (and perl), there is more than one way to do it. If you are using GNU date, then:

date +%x --date="`date --date=\"month\" +%b` 1 day ago"


will give you the last day of the month.
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 02:43 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0