Re: date from day (count) of year

2015-04-24 Thread Vincent Davis
On Fri, Apr 24, 2015 at 8:01 AM, Ian Kelly wrote: > >>> dt.date(2014, 1, 1) + dt.timedelta(114 - 1) > datetime.date(2014, 4, 24) > ​Thanks!​ Vincent Davis -- https://mail.python.org/mailman/listinfo/python-list

Re: date from day (count) of year

2015-04-24 Thread Ian Kelly
On Apr 24, 2015 7:45 AM, "Vincent Davis" wrote: > > How does one get the date given the day of a year. > > >>> dt.datetime.now().timetuple().tm_yday > > 114 > > How would I get the Date of the 114 day of 2014? You could use a timedelta: >>> dt.date(2014, 1, 1) + dt.timedelta(114 - 1) datetime.da

Re: date

2015-03-03 Thread Dave Angel
On 03/02/2015 11:25 AM, Chris Angelico wrote: On Tue, Mar 3, 2015 at 3:09 AM, alister wrote: Sounds ominous. Is that better or worse than the final solution? As in "this program will inadvertantly self distruct in five seconds"? It's usually implied as being externally enforced, so I'd say

Re: date

2015-03-02 Thread greymausg
On 2015-03-02, greymausg wrote: > On 2015-03-02, Steven D'Aprano wrote: >> greymausg wrote: >> >>> I have a csv file, the first item on a line is the date in the format >>> 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, >>> replying "Expecting an integer". (I am really tryi

Re: date

2015-03-02 Thread Mark Lawrence
On 02/03/2015 15:42, Fabien wrote: On 02.03.2015 15:26, Mark Lawrence wrote: Have you tried Pandas? http://pandas.pydata.org/ If your csv file has no other problems, the following should do the trick: import pandas as pd df = pd.read_csv('file.csv', index_col=0, parse_dates= {"time" : [0]})

Re: date

2015-03-02 Thread Mark Lawrence
On 02/03/2015 15:51, Chris Angelico wrote: On Tue, Mar 3, 2015 at 2:24 AM, Mark Lawrence wrote: On 02/03/2015 14:44, Steven D'Aprano wrote: Mark Lawrence wrote: Give me the Steven D'Aprano solution any day of the week. Sounds ominous. Is that better or worse than the final solution?

Re: date

2015-03-02 Thread Chris Angelico
On Tue, Mar 3, 2015 at 3:09 AM, alister wrote: Sounds ominous. Is that better or worse than the final solution? >>> As in "this program will inadvertantly self distruct in five seconds"? >> >> It's usually implied as being externally enforced, so I'd say it's more >> akin to my solu

Re: date

2015-03-02 Thread alister
On Tue, 03 Mar 2015 02:51:28 +1100, Chris Angelico wrote: > On Tue, Mar 3, 2015 at 2:24 AM, Mark Lawrence > wrote: >> On 02/03/2015 14:44, Steven D'Aprano wrote: >>> >>> Mark Lawrence wrote: >>> Give me the Steven D'Aprano solution any day of the week. >>> >>> >>> >>> Sounds ominous. Is that

Re: date

2015-03-02 Thread Chris Angelico
On Tue, Mar 3, 2015 at 2:24 AM, Mark Lawrence wrote: > On 02/03/2015 14:44, Steven D'Aprano wrote: >> >> Mark Lawrence wrote: >> >>> Give me the Steven D'Aprano solution any day of >>> the week. >> >> >> >> Sounds ominous. Is that better or worse than the final solution? >> > > As in "this program

Re: date

2015-03-02 Thread Fabien
On 02.03.2015 15:26, Mark Lawrence wrote: Have you tried Pandas? http://pandas.pydata.org/ If your csv file has no other problems, the following should do the trick: import pandas as pd df = pd.read_csv('file.csv', index_col=0, parse_dates= {"time" : [0]}) Cheers, Fabien IMHO complete ove

Re: date

2015-03-02 Thread Mark Lawrence
On 02/03/2015 14:44, Steven D'Aprano wrote: Mark Lawrence wrote: Give me the Steven D'Aprano solution any day of the week. Sounds ominous. Is that better or worse than the final solution? As in "this program will inadvertantly self distruct in five seconds"? -- My fellow Pythonistas, ask

Re: date

2015-03-02 Thread Tim Golden
On 02/03/2015 14:44, Steven D'Aprano wrote: > Mark Lawrence wrote: > >> Give me the Steven D'Aprano solution any day of >> the week. > > > Sounds ominous. Is that better or worse than the final solution? > > > Well if you can have it on any day of the week it can't be *that* final? TJG --

Re: date

2015-03-02 Thread greymausg
On 2015-03-02, Steven D'Aprano wrote: > greymausg wrote: > >> I have a csv file, the first item on a line is the date in the format >> 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, >> replying "Expecting an integer". (I am really trying to get the offset >> in weeks from th

Re: date

2015-03-02 Thread greymausg
On 2015-03-02, Fabien wrote: > On 02.03.2015 12:55, greymausg wrote: >> I have a csv file, the first item on a line is the date in the format >> 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, >> replying "Expecting an integer". (I am really trying to get the offset >> in wee

Re: date

2015-03-02 Thread Steven D'Aprano
Mark Lawrence wrote: > Give me the Steven D'Aprano solution any day of > the week. Sounds ominous. Is that better or worse than the final solution? -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: date

2015-03-02 Thread Mark Lawrence
On 02/03/2015 12:25, Fabien wrote: On 02.03.2015 12:55, greymausg wrote: I have a csv file, the first item on a line is the date in the format 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, replying "Expecting an integer". (I am really trying to get the offset in weeks fro

Re: date

2015-03-02 Thread Steven D'Aprano
greymausg wrote: > I have a csv file, the first item on a line is the date in the format > 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, > replying "Expecting an integer". (I am really trying to get the offset > in weeks from that date to today()) What is "date"? Where doe

Re: date

2015-03-02 Thread Fabien
On 02.03.2015 12:55, greymausg wrote: I have a csv file, the first item on a line is the date in the format 2015-03-02 I try to get that as a date by date(row[0]), but it barfs, replying "Expecting an integer". (I am really trying to get the offset in weeks from that date to today()) Have you t

Re: Date Difference issue in Python 2.7.8

2015-02-20 Thread Peter Otten
Puruganti Ramesh wrote: > I have an issue in comparing dates in python 2.7.8 No, you are stuck with parsing the dates, you don't get to the point of comparing them. > I am getting below excption > Traceback (most recent call last): > File "FunctionUpdate.py", line 204, in > dt_dateb = datetime

Re: Date Difference issue in Python 2.7.8

2015-02-20 Thread Chris Angelico
On Fri, Feb 20, 2015 at 8:32 PM, Puruganti Ramesh wrote: > import datetime as dt > from datetime import datetime > from datetime import datetime, timedelta, date The first two lines here are achieving nothing - the third should be all you need. > dt_str='2014-5-11' > dt_strq='2014-9-11' > > dt_d

Re: date-time comparison, aware vs naive

2012-12-10 Thread noydb
> > > > > > > > http://docs.python.org/2/library/datetime > > """ An object of type *time* or *datetime* may be naive or *aware" > > > > aware refers to time-zone and daylight savings time, such political > > ephemerals. Two times can only be changed if one knows they're both in > > the

Re: date-time comparison, aware vs naive

2012-12-10 Thread Dave Angel
On 12/10/2012 03:52 PM, Steven D'Aprano wrote: > On Mon, 10 Dec 2012 11:57:37 -0800, noydb wrote: > >> I want to compare a user entered date-and-time against the date-and-time >> of a pdf file. I posted on this (how to get a file's date-time) before, >> was advised to do it like: >> >> import date

Re: date-time comparison, aware vs naive

2012-12-10 Thread noydb
On Monday, December 10, 2012 3:52:55 PM UTC-5, Steven D'Aprano wrote: > On Mon, 10 Dec 2012 11:57:37 -0800, noydb wrote: > > > > > I want to compare a user entered date-and-time against the date-and-time > > > of a pdf file. I posted on this (how to get a file's date-time) before, > > > was a

Re: date-time comparison, aware vs naive

2012-12-10 Thread Steven D'Aprano
On Mon, 10 Dec 2012 11:57:37 -0800, noydb wrote: > I want to compare a user entered date-and-time against the date-and-time > of a pdf file. I posted on this (how to get a file's date-time) before, > was advised to do it like: > > import datetime, os, stat > mtime = os.lstat(filename)[stat.ST_MT

Re: date-time comparison, aware vs naive

2012-12-10 Thread noydb
Found this, and it solved my problem http://blogs.law.harvard.edu/rprasad/2011/09/21/python-string-to-a-datetime-object/ -- http://mail.python.org/mailman/listinfo/python-list

Re: date-time comparison, aware vs naive

2012-12-10 Thread John Gordon
In <21eb3e6f-9a82-47aa-93ff-8f4083d18...@googlegroups.com> noydb writes: > I want to compare a user entered date-and-time against the date-and-time of > a pdf file. I posted on this (how to get a file's date-time) before, was > advised to do it like: > import datetime, os, stat > mtime = os.ls

Re: date and time comparison how to

2012-11-02 Thread Adam Tauno Williams
On Mon, 2012-10-29 at 16:13 -0700, noydb wrote: > All, > I need help with a date and time comparison. > Say a user enters a date-n-time and a file on disk. I want to compare > the date and time of the file to the entered date-n-time; if the file > is newer than the entered date-n-time, add the fil

RE: date and time comparison how to

2012-10-31 Thread Prasad, Ramit
Gary Herron wrote: > On 10/29/2012 04:13 PM, noydb wrote: > > All, > > > > I need help with a date and time comparison. > > > > Say a user enters a date-n-time and a file on disk. I want to compare the > > date and time of the file to the > entered date-n-time; if the file is newer than the enter

Re: date and time comparison how to

2012-10-30 Thread Dave Angel
On 10/30/2012 12:20 AM, noydb wrote: > On Monday, October 29, 2012 11:11:55 PM UTC-4, Dave Angel wrote: >> On 10/29/2012 10:13 PM, noydb wrote: >> >>> I guess I get there eventually! >> >>> >> >> > > okay, I see. > But for the user supplied date... I'm not sure of the format just yet... > test

Re: date and time comparison how to

2012-10-29 Thread Chris Angelico
On Tue, Oct 30, 2012 at 3:20 PM, noydb wrote: > But for the user supplied date... I'm not sure of the format just yet... > testing with a string for now (actual date-date might be possible, tbd > later), so like '10292012213000' (oct 29, 2012 9:30pm). How would you get > that input into a form

Re: date and time comparison how to

2012-10-29 Thread noydb
On Monday, October 29, 2012 11:11:55 PM UTC-4, Dave Angel wrote: > On 10/29/2012 10:13 PM, noydb wrote: > > > I guess I get there eventually! > > > This seems to work > > > > > > pdf_timeStamp = > > time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) > > > intermedia

Re: date and time comparison how to

2012-10-29 Thread MRAB
On 2012-10-30 03:11, Dave Angel wrote: On 10/29/2012 10:13 PM, noydb wrote: I guess I get there eventually! This seems to work pdf_timeStamp = time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) intermediateTime = time.strptime(pdf_timeStamp, "%m%d%y%H%M%S") pdfFile

Re: date and time comparison how to

2012-10-29 Thread Dave Angel
On 10/29/2012 10:13 PM, noydb wrote: > I guess I get there eventually! > This seems to work > > pdf_timeStamp = > time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) > intermediateTime = time.strptime(pdf_timeStamp, "%m%d%y%H%M%S") > pdfFile_compareTime = time.mktime(

Re: date and time comparison how to

2012-10-29 Thread noydb
I guess I get there eventually! This seems to work pdf_timeStamp = time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) intermediateTime = time.strptime(pdf_timeStamp, "%m%d%y%H%M%S") pdfFile_compareTime = time.mktime(intermediateTime) (and I'll do the same to the us

Re: date and time comparison how to

2012-10-29 Thread noydb
if I do time.time() I get 1351562187.757, do it again I get 1351562212.2650001 --- so I can compare those, the latter is later then the former. Good. SO how do I turn pdf_timeStamp (a string) above into time in this (as from time.time()) format? Am I on the right track -- is that the way to d

Re: date and time comparison how to

2012-10-29 Thread noydb
Thanks, I did find this... pdf_timeStamp = time.strftime("%m%d%y%H%M%S",time.localtime(os.path.getmtime(pdf))) >> pdf_timestamp >> '102909133000' ... but now how to do the comparison? Cannot just do a raw string comparison, gotta declare it a date -- http://mail.python.org/mailman/listinfo/p

Re: date and time comparison how to

2012-10-29 Thread MRAB
On 2012-10-30 00:04, Gary Herron wrote: On 10/29/2012 04:13 PM, noydb wrote: All, I need help with a date and time comparison. Say a user enters a date-n-time and a file on disk. I want to compare the date and time of the file to the entered date-n-time; if the file is newer than the entere

Re: date and time comparison how to

2012-10-29 Thread Gary Herron
On 10/29/2012 04:13 PM, noydb wrote: All, I need help with a date and time comparison. Say a user enters a date-n-time and a file on disk. I want to compare the date and time of the file to the entered date-n-time; if the file is newer than the entered date-n-time, add the file to a list to

Re: Date Parsing Question

2010-09-03 Thread David Bolen
Gavin writes: > python-dateutil seems to work very well if everything is in English, > however, it does not seem to work for other languages and the > documentation does not seem to have any information about locale > support. Probably because I don't think there is much built in. You'll want t

Re: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread D'Arcy J.M. Cain
On Thu, 22 Oct 2009 10:56:07 + baboucarr sanneh wrote: > > By the way, the convention on this list is to bottom-post, > > okay i got that will be doing so from now on :)thnx Thanks but what the previous poster forgot to mention was that you should also trim the text that you are replying

RE: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread baboucarr sanneh
$LIM $...@dy > Date: Thu, 22 Oct 2009 11:51:08 +0100 > From: m...@timgolden.me.uk > CC: python-list@python.org > Subject: Re: Date strftime('%d%m%y') date to be of yesterday > > baboucarr sanneh wrote: > > > > Hi tim > > > > Thank yo

Re: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread Tim Golden
baboucarr sanneh wrote: Hi tim Thank you very much ...I have got it now..now i can continue with the backup script i want to make By the way, the convention on this list is to bottom-post, that is to add your comments / reply to the bottom of the post you're replying to. These things vary

RE: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread baboucarr sanneh
Hi tim Thank you very much ...I have got it now..now i can continue with the backup script i want to make $LIM $...@dy > Date: Thu, 22 Oct 2009 11:36:50 +0100 > From: m...@timgolden.me.uk > CC: python-list@python.org > Subject: Re: Date strftime('%d%m%y') d

Re: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread Tim Golden
baboucarr sanneh wrote: Hi tim, well i tried what your script but i do have an error import datetime yesterday = datetime.date.today () - datetime.timedelta (days=1) print yesterday.strftime ("%d%m%y") SyntaxError: invalid syntax (, line 1) when i jus check the variable i.e yesterday i do ge

RE: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread baboucarr sanneh
le i.e yesterday i do get the out put but its in a different format datetime.date(2009, 10, 21) it seems like the conversion that is where the error is coming form I want it to be like 211009 Thank you $LIM $...@dy > Date: Thu, 22 Oct 2009 11:14:46 +0100 > From: m...@timgolden.me.uk

Re: Date strftime('%d%m%y') date to be of yesterday

2009-10-22 Thread Tim Golden
baboucarr sanneh wrote: Hi all I want to output the date of the with this format strftime('%d%m%y') but the date ie '%d' should be the date of yesterday eg import time strftime('%d%m%y') # something like minus a day.. Thank you..am a newbie to python import datetime yesterday = datetime.d

Re: Date using input

2009-09-25 Thread Dave Angel
flebber.c...@gmail.com wrote: I don't think I am using re.compile properly, but thought as this would make my output an object it would be better for later, is that correct? #Obtain date def ObtainDate(date): date = raw_input("Type Date dd/mm/year: ") re.split('[/]+', date) date year = date[-1

Re: Re: Re: Date using input

2009-09-24 Thread flebber . crue
I don't think I am using re.compile properly, but thought as this would make my output an object it would be better for later, is that correct? #Obtain date def ObtainDate(date): date = raw_input("Type Date dd/mm/year: ") re.split('[/]+', date) date year = date[-1] month = date[1] day = date[0]

Re: Date using input

2009-09-24 Thread Sean DiZazzo
On Sep 24, 7:49 am, flebber wrote: > On Sep 24, 11:10 pm, flebber wrote: > > > > > On Sep 24, 10:58 pm, Dave Angel wrote: > > > > flebber.c...@gmail.com wrote: > > > > I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no > > > > class or instructor, I am learning this myself. I ha

Re: Re: Date using input

2009-09-24 Thread flebber . crue
Okay, thanks for the advice that sounds a good place to start. I used %2.os was an attempt to define width and precision to stop typo errors eg the user accidentally inputing 101/09/2009 or similar error. So that the __/__/ was adhered to. I will go back to the start get the basics happ

Re: Date using input

2009-09-24 Thread Dave Angel
flebber wrote: On Sep 24, 11:10 pm, flebber wrote: On Sep 24, 10:58 pm, Dave Angel wrote: flebber.c...@gmail.com wrote: I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or instructor, I am learning this myself. I have Hetlands book "Beginning Python

Re: Date using input

2009-09-24 Thread Tim Chase
Surely getting it tottally mixed up from datetime import date def ObtainDate(params): date = raw_input("Type Date dd/mm/year: %2.0r%2.0r/%2.0r%2.0r/%4.0r %4.0r%4.0r%4.0r") print date.datetime(year-month-day) By setting "date = raw_input(...)", you mask the datetime.date object preventing yo

Re: Date using input

2009-09-24 Thread flebber
On Sep 24, 11:10 pm, flebber wrote: > On Sep 24, 10:58 pm, Dave Angel wrote: > > > > > flebber.c...@gmail.com wrote: > > > I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no > > > class or instructor, I am learning this myself. I have Hetlands book > > > "Beginning Python Novice

Re: Date using input

2009-09-24 Thread flebber
On Sep 24, 10:58 pm, Dave Angel wrote: > flebber.c...@gmail.com wrote: > > I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no > > class or instructor, I am learning this myself. I have Hetlands book > > "Beginning Python Novice to Professional and online documentation > > books so

Re: Date using input

2009-09-24 Thread Dave Angel
flebber.c...@gmail.com wrote: I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or instructor, I am learning this myself. I have Hetlands book "Beginning Python Novice to Professional and online documentation books so Dive into Python, python.org etc. Using the SPE edi

Re: Re: Date using input

2009-09-24 Thread flebber . crue
I am using python 2.6.2, I haven't updated to 3.0 yet. No I have no class or instructor, I am learning this myself. I have Hetlands book "Beginning Python Novice to Professional and online documentation books so Dive into Python, python.org etc. Using the SPE editor. I have currently only

Re: Date using input

2009-09-24 Thread Dave Angel
flebber wrote: Sorry to ask a simple question but I am a little confused how to combine the input function and the date time module. Simply at the start of the program I want to prompt the user to enter the date, desirably in the format dd/mm/year. However I want to make sure that python underst

Re: Date Comparison

2009-02-04 Thread Colin J. Williams
Bill McClain wrote: On 2009-02-03, mohana2...@gmail.com wrote: Hi, I need to compare two dates and find the number of days between those two dates.This can be done with datetime module in python as below, but this is not supported in Jython. There are julian day routines in this astronomy pa

Re: Date Comparison

2009-02-03 Thread Mark Wooding
mohana2...@gmail.com writes: > I need to compare two dates and find the number of days between those > two dates.This can be done with datetime module in python as below, > but this is not supported in Jython. > > example > from datetime import date > a=datetime.date(2009,2,1) > b=datetime.date(2

Re: Date Comparison

2009-02-03 Thread Diez B. Roggisch
Simon Brunning wrote: > 2009/2/3 Diez B. Roggisch : >> Use the java API of java.util. > > Or better still, use Joda. > "dates compare you must?" SCNR. Didn't know of this incarnation of him... Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Date Comparison

2009-02-03 Thread Simon Brunning
2009/2/3 Diez B. Roggisch : > Use the java API of java.util. Or better still, use Joda. -- Cheers, Simon B. -- http://mail.python.org/mailman/listinfo/python-list

Re: Date Comparison

2009-02-03 Thread Bill McClain
On 2009-02-03, mohana2...@gmail.com wrote: > Hi, > I need to compare two dates and find the number of days between those > two dates.This can be done with datetime module in python as below, > but this is not supported in Jython. There are julian day routines in this astronomy package: http

Re: Date Comparison

2009-02-03 Thread Diez B. Roggisch
mohana2...@gmail.com wrote: > Hi, > I need to compare two dates and find the number of days between those > two dates.This can be done with datetime module in python as below, > but this is not supported in Jython. > > example > from datetime import date > a=datetime.date(2009,2,1) > b=datetime.

Re: date handling problem

2009-01-29 Thread S.Selvam Siva
On Thu, Jan 29, 2009 at 2:27 PM, M.-A. Lemburg wrote: > On 2009-01-29 03:38, Gabriel Genellina wrote: > > En Wed, 28 Jan 2009 18:55:21 -0200, S.Selvam Siva > > escribió: > > > >> I need to parse rss-feeds based on time stamp,But rss-feeds follow > >> different > >> standards of date(IST,EST etc)

Re: date handling problem

2009-01-29 Thread M.-A. Lemburg
On 2009-01-29 03:38, Gabriel Genellina wrote: > En Wed, 28 Jan 2009 18:55:21 -0200, S.Selvam Siva > escribió: > >> I need to parse rss-feeds based on time stamp,But rss-feeds follow >> different >> standards of date(IST,EST etc). >> I dont know,how to standardize this standards.It will be helpful

Re: date handling problem

2009-01-28 Thread Gabriel Genellina
En Wed, 28 Jan 2009 18:55:21 -0200, S.Selvam Siva escribió: I need to parse rss-feeds based on time stamp,But rss-feeds follow different standards of date(IST,EST etc). I dont know,how to standardize this standards.It will be helpful if you can hint me. You may find the Olson timezone

Re: date format

2009-01-21 Thread Tim Chase
Ahmed, Shakir wrote: I am grabbing few fields from a table and one of the columns is in date format. The output which I am getting is "Wed Feb 09 00:00:00 2005" but the data in that column is "02/09/2005" and I need the same format output to insert those recodes into another table. print my_serv

Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread W. eWatson
The author has updated the Tutorial and added a flex method. -- http://mail.python.org/mailman/listinfo/python-list

Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread W. eWatson
John Machin wrote: On Aug 30, 10:41 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: What I'm trying to do is adjust date-time stamped file names for date and time errors. The software program collects through a period that roughly coincides with night hours every day and according to the OS clock.

Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread W. eWatson
W. eWatson wrote: John Machin wrote: On Aug 30, 10:41 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: What I'm trying to do is adjust date-time stamped file names for date and time errors. The software program collects through a period that roughly coincides with night hours every day and accordi

Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread W. eWatson
John Machin wrote: On Aug 30, 10:41 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: What I'm trying to do is adjust date-time stamped file names for date and time errors. The software program collects through a period that roughly coincides with night hours every day and according to the OS clock.

Re: Date Comparison and Manipulation Functions?

2008-08-30 Thread Hendrik van Rooyen
John Machin wrote: >On Aug 30, 10:41 am, "W. eWatson" wrote: > >> What I'm trying to do is adjust date-time stamped file names for date and >> time errors. The software program collects through a period that roughly >> coincides with night hours every day and according to the OS clock. It >> so

Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread John Machin
On Aug 30, 10:41 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > What I'm trying to do is adjust date-time stamped file names for date and > time errors. The software program collects through a period that roughly > coincides with night hours every day and according to the OS clock. It > sometimes h

Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread W. eWatson
John Machin wrote: On Aug 30, 2:32 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: I just tried the following code, and got an unexpected result. from pyfdate import * t = Time() ts = Time(2008, 8, 29,15,20,7) tnew = ts.plus(months=6) print "new date: ", tnew Result: new date: 2009-02-28 15:20:0

Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread John Machin
On Aug 30, 2:32 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > I just tried the following code, and got an unexpected result. > > from pyfdate import * > t = Time() > > ts = Time(2008, 8, 29,15,20,7) > tnew = ts.plus(months=6) > print "new date: ", tnew > > Result: > new date: 2009-02-28 15:20:07 >

Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread norseman
W. eWatson wrote: I just tried the following code, and got an unexpected result. from pyfdate import * t = Time() ts = Time(2008, 8, 29,15,20,7) tnew = ts.plus(months=6) print "new date: ", tnew Result: new date: 2009-02-28 15:20:07 I believe that should be April 1, 2009. If I use months = 1

Re: Date Comparison and Manipulation Functions?

2008-08-29 Thread W. eWatson
I just tried the following code, and got an unexpected result. from pyfdate import * t = Time() ts = Time(2008, 8, 29,15,20,7) tnew = ts.plus(months=6) print "new date: ", tnew Result: new date: 2009-02-28 15:20:07 I believe that should be April 1, 2009. If I use months = 1 and day =31, I ge

Re: Date type in win32com?

2008-08-27 Thread Gabriel Genellina
En Tue, 26 Aug 2008 08:53:40 -0300, Haeyoung Kim <[EMAIL PROTECTED]> escribi�: I'm migrating a VBScript into python. How should I convert Date type parameter in VBScript's COM interface with win32com? Look for PyTime in the pywin32 documentation. -- Gabriel Genellina -- http://mail.pytho

Re: Date Comparison and Manipulation Functions?

2008-08-27 Thread W. eWatson
John Machin wrote: On Aug 27, 11:24 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: John Machin wrote: On Aug 27, 10:21 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: I'm using IDLE for Python 2.4, and put pfydate distribution in C:\Python24\Lib\site-packages\pfydate, as required by the page. How to

Re: Date type in win32com?

2008-08-27 Thread Tim Golden
Haeyoung Kim wrote: Hi. I'm migrating a VBScript into python. How should I convert Date type parameter in VBScript's COM interface with win32com? I couldn't find any answer yet... Could you give an example of code you're trying to translate? Normally it's quite simple, but different subsyste

Re: Date Comparison and Manipulation Functions?

2008-08-27 Thread John Machin
On Aug 27, 11:24 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > On Aug 27, 10:21 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > >> I'm using IDLE for Python 2.4, and put pfydate distribution in > >> C:\Python24\Lib\site-packages\pfydate, as required by the > >> page. > >> How

Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread Benjamin Kaplan
On Tue, Aug 26, 2008 at 9:24 PM, W. eWatson <[EMAIL PROTECTED]> wrote: > John Machin wrote: > >> On Aug 27, 10:21 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: >> >>> I'm using IDLE for Python 2.4, and put pfydate distribution in >>> C:\Python24\Lib\site-packages\pfydate, as required by the >>> pag

Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread W. eWatson
John Machin wrote: On Aug 27, 10:21 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: I'm using IDLE for Python 2.4, and put pfydate distribution in C:\Python24\Lib\site-packages\pfydate, as required by the page. How to install pyfdate. Save pyfdate.py into your PythonNN/Lib/site-packages direc

Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread John Machin
On Aug 27, 10:21 am, "W. eWatson" <[EMAIL PROTECTED]> wrote: > > I'm using IDLE for Python 2.4, and put pfydate distribution in > C:\Python24\Lib\site-packages\pfydate, as required by the > page. > How to install pyfdate. > > Save pyfdate.py into your PythonNN/Lib/site-packages directory. > I

Re: Date Comparison and Manipulation Functions?

2008-08-26 Thread W. eWatson
[EMAIL PROTECTED] wrote: check out Pyfdate: http://www.ferg.org/pyfdate from pyfdate import * t = Time().add(hours=14) print "It is now", t.wdt datestring1 = "2005/10/05" #year,month,day datestring2 = "2002/09/22" #year,month,day datestring3 = "2007/11/11" #year,month,day year,month,day = num

Re: Date Comparison and Manipulation Functions?

2008-08-25 Thread W. eWatson
[EMAIL PROTECTED] wrote: check out Pyfdate: http://www.ferg.org/pyfdate from pyfdate import * t = Time().add(hours=14) print "It is now", t.wdt datestring1 = "2005/10/05" #year,month,day datestring2 = "2002/09/22" #year,month,day datestring3 = "2007/11/11" #year,month,day year,month,day = num

Re: Date Comparison and Manipulation Functions?

2008-08-24 Thread zuul
check out Pyfdate: http://www.ferg.org/pyfdate from pyfdate import * t = Time().add(hours=14) print "It is now", t.wdt datestring1 = "2005/10/05" #year,month,day datestring2 = "2002/09/22" #year,month,day datestring3 = "2007/11/11" #year,month,day year,month,day = numsplit(datestring1) # split

Re: Date Comparison and Manipulation Functions?

2008-08-24 Thread Paul Rudin
"W. eWatson" <[EMAIL PROTECTED]> writes: > Are there some date and time comparison functions that would compare, say, > > Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) > Is 02/11/07 the same as 02/11/07? > > Is 14:05:18 after 22:02:51? (24 hour day is fine) > > How about the dat

Re: Date Subtraction

2006-06-18 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >>In <[EMAIL PROTECTED]>, >>rsutradhar_python wrote: >>> date1="2006-01-10" >>> date2="2005-12-15" >>> date = date1 - date2 >>> should give me 25 but problem is tha

Re: Date Subtraction

2006-06-18 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >In <[EMAIL PROTECTED]>, >rsutradhar_python wrote: > >> How to subtract date which is stored in string variable? >> >> Example: >> >> date1="2006-01-10" >> date2="2005-12-15" >> date = date1 - date2 >> should giv

Re: Date Subtraction

2006-06-16 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, rsutradhar_python wrote: > How to subtract date which is stored in string variable? > > Example: > > date1="2006-01-10" > date2="2005-12-15" > date = date1 - date2 > should give me 25 but problem is that date1 and date2 datatype is > string which need to be conerted into

Re: date reformatting

2005-10-11 Thread Magnus Lycka
Bell, Kevin wrote: > Anyone aware of existing code to turn a date string "8-15-05" into the > number 20050815? >>> import datetime >>> s = "8-15-05" >>> month,day,year = map(int, s.split('-')) >>> date = datetime.date(2000+year,month,day) >>> date.strftime('%Y%m%d') '20050815' Of course, if

Re: date reformatting

2005-10-06 Thread elbertlev
setup.py install -- http://mail.python.org/mailman/listinfo/python-list

Re: date reformatting

2005-10-06 Thread Larry Bates
There's more than one way, but this one will work for dates prior to 2000. import time datestring='8-15-05' d=time.strptime(datestring,'%m-%d-%y') number=1*d[0]+100*d[1]+d[2] print number -Larry Bates Bell, Kevin wrote: > Anyone aware of existing code to turn a date string "8-15-05" into the

Re: date reformatting

2005-10-06 Thread Fredrik Lundh
"Bell, Kevin" wrote: > Anyone aware of existing code to turn a date string "8-15-05" into the > number 20050815? date = "8-15-05" import re m, d, y = map(int, re.match("(\d+)-(\d+)-(\d+)$", date).groups()) number = 2000 + y*1 + m*100 + d print number -- http://mail.python.org/mai

Re: Date & time in a Zip File

2005-07-13 Thread Scott David Daniels
Tim Williams (gmail) wrote: > Using zipfile.Zipfile > > How can I add a file to a zip file and keep its date and time correct? > Currently the date/time change to the time the file was added to the > zip.Zipinfo doesn't have a write method! > > Solutions other than zipfile are welcome, with

Re: Date & time in a Zip File

2005-07-13 Thread Larry Bates
When I add files to my .ZIP files using python zipfile module the date/time that is stored in mine is the one that comes from the file's attributes. I'm not sure I understand why you think yours are not. -Larry Bates Tim Williams (gmail) wrote: > Using zipfile.Zipfile > > How can I add a file

Re: date and time range checking

2005-06-02 Thread Andrew Dalke
Maksim Kasimov wrote: > there are few of a time periods, for example: > 2005-06-08 12:30 -> 2005-06-10 15:30, > 2005-06-12 12:30 -> 2005-06-14 15:30 > > and there is some date and time value: > 2005-06-11 12:30 > what is the "pythonic" way to check is the date/time value in th

Re: date and time range checking

2005-06-02 Thread Peter Hansen
Maksim Kasimov wrote: > what is the "pythonic" way to check is the date/time value in the given > periods range? Something like this, though I won't make strong claims of "pythonicness". If you want to use the "in" keyword you'll want a custom class and overriding of __contains__. import time

Re: date to digit

2005-04-30 Thread Fabio Pliger
"Sara Khalatbari" <[EMAIL PROTECTED]> ha scritto nel messaggio news:[EMAIL PROTECTED] > Is there a program in python that inputs a date & a > time, for example: "2005-04-17 04:20+". And > returns a digit, for example: "3501" instead? > > and if there is such program or built-in function, how

  1   2   >