LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 09-22-2007, 05:35 AM   #1
kpachopoulos
Member
 
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 704

Rep: Reputation: 30
find YYYYMMDD and YYYYMMDD difference


Hi,
does any body now any such algorith either Java or python implemented? to find difference in days from YYYYMMDD to YYYYMMDD?
Or just an algorithm, that converts YYYYMMDD to seconds since the epoch(either Java or python implemented)?

Thanks
 
Old 09-22-2007, 11:37 AM   #2
uselpa
Senior Member
 
Registered: Oct 2004
Location: Luxemburg
Distribution: Slackware, OS X
Posts: 1,507

Rep: Reputation: 46
Python has it built-in:
Code:
pu@slackw:~$ python
Python 2.5.1 (r251:54863, May  4 2007, 16:52:23)
[GCC 4.1.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import datetime
>>> a=datetime.datetime(2007,9,22)
>>> b=datetime.datetime(1967,5,19)
>>> a-b
datetime.timedelta(14736)
>>> (a-b).days
14736
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find with -exec argument - not giving proper output..how to find... hinetvenkat Linux - Server 4 01-25-2010 07:19 AM
Make,find difference between Enterprise Servers and choose snitoor Linux - Server 1 06-07-2007 11:15 AM
Wat is main difference between find and locate command. rktech83 Linux - General 1 03-08-2006 08:38 AM
reqd to find the difference between two files Prasun1 Linux - General 7 09-09-2005 06:16 PM
How can i find the difference for directory alice95089 Linux - Software 4 02-07-2005 09:49 AM


All times are GMT -5. The time now is 04:04 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration