From unknown Sat Aug 16 16:23:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6485: i have one question? Resent-From: upload amritsar Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 21 Jun 2010 16:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6485 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: 6485@debbugs.gnu.org Cc: X-Debbugs-Original-To: Received: via spool by submit@debbugs.gnu.org id=B.127713751521052 (code B ref -1); Mon, 21 Jun 2010 16:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jun 2010 16:25:15 +0000 From: upload amritsar Date: Mon, 21 Jun 2010 13:49:09 +0530 X-Sent: 8 hours, 2 minutes, 39 seconds ago X-Mailer: Evolution 2.0.2 (2.0.2-27.rhel4.6) Hi, Good Morning can you plese tell me what is the procedure or command to find the days between two date supoose we have 2 date first one 01-01-2008 second one 21-06-2010 then how can we calculate days between these two date . Regards, Deepak +91-9988049558 "The information contained in this electronic message and any attachments to this message are intended for exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at LIC OF INDIA or co_mailadmin@licindia.com immediately and destroy all copies of this message and any attachments. The views expressed in this E-mail message / Attachments, are those of the individual sender." ---------- From unknown Sat Aug 16 16:23:31 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6485: i have one question? References: In-Reply-To: Resent-From: Bob Proulx Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-coreutils@gnu.org Resent-Date: Mon, 21 Jun 2010 21:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6485 X-GNU-PR-Package: coreutils X-GNU-PR-Keywords: To: upload amritsar Cc: dipakhp@rediffmail.com, 6485@debbugs.gnu.org Received: via spool by 6485-submit@debbugs.gnu.org id=B6485.127715684429713 (code B ref 6485); Mon, 21 Jun 2010 21:48:02 +0000 Received: (at 6485) by debbugs.gnu.org; 21 Jun 2010 21:47:24 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQopw-0007jC-BJ for submit@debbugs.gnu.org; Mon, 21 Jun 2010 17:47:24 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQopt-0007j7-5F for 6485@debbugs.gnu.org; Mon, 21 Jun 2010 17:47:22 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.230.115]) by joseki.proulx.com (Postfix) with ESMTP id 81EF721367; Mon, 21 Jun 2010 15:47:16 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 78B1D3CC39A; Mon, 21 Jun 2010 15:47:16 -0600 (MDT) Date: Mon, 21 Jun 2010 15:47:16 -0600 From: Bob Proulx Message-ID: <20100621214716.GA3869@dementia.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam-Score: -0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.1 (/) retitle 6485 Days Between Dates? How? thanks upload amritsar wrote: > can you plese tell me what is the procedure or command to find the days > between two date If you would be so kind could you in the future address these types of questions to coreutils@gnu.org instead of bug-coreutils? The bug-coreutils address has been changed from "all-discussion" to "bug-discussion" and along with that change every message here now opens a bug ticket in the bug tracking system so that we don't lose track of reported bugs. The coreutils@gnu.org address was created for general discussion that isn't attached to the bug tracking system. Thanks! > supoose we have 2 date first one 01-01-2008 second one 21-06-2010 then > how can we calculate days between these two date . GNU date itself doesn't include any direct support for finding days between dates. But it can be used as part of a script to find this information. The technique is to convert each date to an integer value such as a Julian Day Number or seconds of the Unix epoch and then do take the difference and convert back. I will use Unix seconds in an example. Plus the date must be in a format that can be parsed by GNU date. date1="2008-01-01" date2="2010-06-21" date1seconds=$(date -d "$date1 12:00" +%s) date2seconds=$(date -d "$date2 12:00" +%s) totalseconds=$(( $date2seconds - $date1seconds)) secondsperday=86400 days=$(( $totalseconds / $secondsperday )) echo "There were $days days between $date1 and $date2" And of course that can be shorted up considerably by applying the constructs inline but I wanted to make things as illustrative as possible and so expanded them out. $ echo Days between dates: $(( ( $(date -d "2010-06-21 12:00" +%s) - $(date -d "2008-01-01 12:00" +%s) ) / 86400 )) I find it is often best to do date calculations using 12:00 noon so as to avoid any daylight savings time issues. > "The information contained in this electronic message and any > attachments to this message are intended for exclusive use of the > addressee(s) and may contain confidential or privileged > information. If you are not the intended recipient, please notify > the sender at LIC OF INDIA or co_mailadmin@licindia.com immediately > and destroy all copies of this message and any attachments. The > views expressed in this E-mail message / Attachments, are those of > the individual sender." Please don't post questions to public mailing lists with such a disclaimer attached to it. They are worthless and completely unenforceable but annoy many of us greatly. Please see this reference. http://goldmark.org/jeff/stupid-disclaimers/ If you cannot avoid such a disclaimer being attached to your email because your company does it to you automatically then please do not send mail from your company email account. Instead please sign up for and use one of the many free email accounts that are readily available on the Internet when corresponding with the Internet community. They are free. They are available. Do it for the good of the community. Bob From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 21 17:50:38 2010 Received: (at control) by debbugs.gnu.org; 21 Jun 2010 21:50:39 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQot4-0007kc-Nv for submit@debbugs.gnu.org; Mon, 21 Jun 2010 17:50:38 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQot3-0007kW-5U for control@debbugs.gnu.org; Mon, 21 Jun 2010 17:50:37 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.230.115]) by joseki.proulx.com (Postfix) with ESMTP id 1110721367 for ; Mon, 21 Jun 2010 15:50:33 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 069513CC39A; Mon, 21 Jun 2010 15:50:33 -0600 (MDT) Date: Mon, 21 Jun 2010 15:50:33 -0600 From: Bob Proulx To: control@debbugs.gnu.org Subject: Closing bug#6485: i have one question? Message-ID: <20100621215032.GB3869@dementia.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam-Score: -2.4 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.4 (--) close 6485 thanks Closing this as not-a-bug. However please feel free to continue the discussion here until done. Bob From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 21 18:10:57 2010 Received: (at control) by debbugs.gnu.org; 21 Jun 2010 22:10:57 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQpCi-0008UD-U8 for submit@debbugs.gnu.org; Mon, 21 Jun 2010 18:10:57 -0400 Received: from joseki.proulx.com ([216.17.153.58]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQpCh-0008U8-Bk for control@debbugs.gnu.org; Mon, 21 Jun 2010 18:10:55 -0400 Received: from dementia.proulx.com (dementia.proulx.com [192.168.230.115]) by joseki.proulx.com (Postfix) with ESMTP id 90FE421367 for ; Mon, 21 Jun 2010 16:10:50 -0600 (MDT) Received: by dementia.proulx.com (Postfix, from userid 1000) id 8A721C3F72E; Mon, 21 Jun 2010 16:10:50 -0600 (MDT) Date: Mon, 21 Jun 2010 16:10:50 -0600 From: Bob Proulx To: control@debbugs.gnu.org Subject: changing title Message-ID: <20100621221050.GA13832@dementia.proulx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam-Score: -1.6 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.4 (--) retitle 6485 Days Between Dates? How? thanks