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 a

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

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 > 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 dat

date-time comparison, aware vs naive

2012-12-10 Thread noydb
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_MTIME] // the files modification tim

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-12 Thread Pete Forman
John Nagle writes: >I want to parse standard ISO date/time strings such as > > 2012-09-09T18:00:00-07:00 > > into Python "datetime" objects. Consider whether RFC 3339 might be a more suitable format. It is a subset of ISO 8601 extended format. Some of the

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-11 Thread Ben Finney
Roy Smith writes: > In article , > Chris Angelico wrote: > > What is it that takes up forty pages [for the ISO 8601 > > specification]? RFC 2822 describes a date/time stamp in about two > > pages. In fact, the whole RFC describes the Internet Message Format > >

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-10 Thread Roy Smith
In article , Chris Angelico wrote: > On Tue, Sep 11, 2012 at 7:46 AM, Rhodri James > wrote: > > On Sun, 09 Sep 2012 13:14:30 +0100, Roy Smith wrote: > > > >> In article , > >> Thomas Jollans wrote: > >> > >>> The ISO date/time

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-10 Thread Chris Angelico
On Tue, Sep 11, 2012 at 7:46 AM, Rhodri James wrote: > On Sun, 09 Sep 2012 13:14:30 +0100, Roy Smith wrote: > >> In article , >> Thomas Jollans wrote: >> >>> The ISO date/time format is dead simple and well-defined. > > >> Well defined, perhaps. Bu

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-10 Thread Rhodri James
On Sun, 09 Sep 2012 13:14:30 +0100, Roy Smith wrote: In article , Thomas Jollans wrote: The ISO date/time format is dead simple and well-defined. Well defined, perhaps. But nobody who has read the standard could call it "dead simple". ISO-8601-2004(E) is 40 pages long.

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-09 Thread Roy Smith
In article , Thomas Jollans wrote: > The ISO date/time format is dead simple and well-defined. Well defined, perhaps. But nobody who has read the standard could call it "dead simple". ISO-8601-2004(E) is 40 pages long. Of course, that fact that it's complicated enough to

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-09 Thread Mark Lawrence
On 09/09/2012 11:15, Roy Smith wrote: In article , John Nagle wrote: This really should be handled in the standard library, instead of everybody rolling their own, badly. +1 I'll second that given "There should be one-- and preferably only one --obvious way to do it". -- Cheers. Mark

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-09 Thread Roy Smith
In article , John Nagle wrote: > This really should be handled in the standard library, instead of > everybody rolling their own, badly. +1 -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-08 Thread John Nagle
> > iso-8601 0.2.3 Flexible ISO 8601 parser... > PySO8601 0.1.7 PySO8601 aims to parse any ISO 8601 date... > isodate 0.4.8An ISO 8601 date/time/duration parser and formater > > All three have been updated this year. There's another one inside

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-08 Thread John Gleeson
date... isodate 0.4.8An ISO 8601 date/time/duration parser and formater All three have been updated this year. -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-08 Thread André Malo
* Roy Smith wrote: > The third is that I never use methods I can't figure out how to > pronounce. here: strip'time nd -- Flhacs wird im Usenet grundsätzlich alsfhc geschrieben. Schreibt man lafhsc nicht slfach, so ist das schlichtweg hclafs. Hingegen darf man rihctig ruhig rhitcgi schreiben, we

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Terry Reedy
On 9/6/2012 3:44 PM, Thomas Jollans wrote: On 09/06/2012 09:27 PM, John Nagle wrote: In Python 2.7: I want to parse standard ISO date/time strings such as 2012-09-09T18:00:00-07:00 into Python "datetime" objects. The "datetime" object off

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Roy Smith
In article , Dave Angel wrote: > For working with datetime, see > http://docs.python.org/library/datetime.html#datetime.datetime > > and look up datetime.strptime() strptime has two problems. One is that it's a pain to use (you have to look up all those inscrutable %-thingies every time

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Roy Smith
In article , John Nagle wrote: > In Python 2.7: > >I want to parse standard ISO date/time strings such as > > 2012-09-09T18:00:00-07:00 > > into Python "datetime" objects. The "datetime" object offers > an output method , datetimeobj.is

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Miki Tebeka
andoned; it hasn't been > > >> updated since 2007 and has many outstanding issues. > > > > > > Hmm, I have some code that uses ISO date/time strings and just checked > > > to see how I did it, and it looks like it uses iso8601-0.1.4-py2.6.egg . >

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread John Nagle
On 9/6/2012 12:51 PM, Paul Rubin wrote: > John Nagle writes: >> There's an iso8601 module on PyPi, but it's abandoned; it hasn't been >> updated since 2007 and has many outstanding issues. > > Hmm, I have some code that uses ISO date/time strings and just c

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Dave Angel
On 09/06/2012 03:27 PM, John Nagle wrote: > In Python 2.7: > >I want to parse standard ISO date/time strings such as > > 2012-09-09T18:00:00-07:00 > > into Python "datetime" objects. The "datetime" object offers > an output method , dateti

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Paul Rubin
John Nagle writes: > There's an iso8601 module on PyPi, but it's abandoned; it hasn't been > updated since 2007 and has many outstanding issues. Hmm, I have some code that uses ISO date/time strings and just checked to see how I did it, and it looks like it uses iso8601-0.1.

Re: Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread Thomas Jollans
On 09/06/2012 09:27 PM, John Nagle wrote: > In Python 2.7: > >I want to parse standard ISO date/time strings such as > > 2012-09-09T18:00:00-07:00 > > into Python "datetime" objects. The "datetime" object offers > an output method , dateti

Parsing ISO date/time strings - where did the parser go?

2012-09-06 Thread John Nagle
In Python 2.7: I want to parse standard ISO date/time strings such as 2012-09-09T18:00:00-07:00 into Python "datetime" objects. The "datetime" object offers an output method , datetimeobj.isoformat(), but not an input parser. There ought to be

Re: parse date/time from a log entry with only strftime (and no regexen)

2010-11-11 Thread Simon Mullis
This was a long time ago But just in case anyone googling ever has the same question, this is what I did (last year). The user just needs to supply a strftime formatted string, such as "%A, %e %b %h:%M" and this Class figures out the regex to use on the log entries... class RegexBuilder(object

Re: Convert Unix timestamp to Readable Date/time

2010-07-22 Thread Chris Rebert
On Thu, Jul 22, 2010 at 5:54 AM, kak...@gmail.com wrote: > Well i have the following number 1279796174846 >  i did the following: > > mdate = 1279796174846 > tempStr = str(mdate) > tempStr2 = tempStr[:-3] > tempInt = int(tempStr2) > print "Last Login :", datetime.datetime.fromtimestamp(tempInt) >

Convert Unix timestamp to Readable Date/time

2010-07-22 Thread kak...@gmail.com
Well i have the following number 1279796174846 i did the following: mdate = 1279796174846 tempStr = str(mdate) tempStr2 = tempStr[:-3] tempInt = int(tempStr2) print "Last Login :", datetime.datetime.fromtimestamp(tempInt) that prints out: 2010-07-22 06:56:14 But when i check my answer at http://

Re: Python date time API

2010-04-26 Thread Jason Scheirer
On Apr 26, 8:21 am, rk wrote: > Hi, > >  I am python novice, trying to convert a boost::gregorian::date out to > python using PyDateTime C-api interface. I was coring because the C- > API failed to initialize. The error was: > > AttributeError: "module" object has not attribute datetime_CAPI > > A

Python date time API

2010-04-26 Thread rk
Hi, I am python novice, trying to convert a boost::gregorian::date out to python using PyDateTime C-api interface. I was coring because the C- API failed to initialize. The error was: AttributeError: "module" object has not attribute datetime_CAPI As indicated by the error, a dir(datetime) give

Re: convert date time

2009-08-22 Thread John Machin
On Aug 22, 5:11 pm, Kushal Kumaran wrote: > On Fri, Aug 21, 2009 at 11:44 PM, Ronn Ross wrote: > > I'm new to python and I'm getting a date time from a field in the database > > that looks like this: > > 8/2/2009 8:36:16 AM (UTC) > datetime.datetime.strptime

Re: convert date time

2009-08-22 Thread Kushal Kumaran
On Fri, Aug 21, 2009 at 11:44 PM, Ronn Ross wrote: > I'm new to python and I'm getting a date time from a field in the database > that looks like this: > 8/2/2009 8:36:16 AM (UTC) > > I want to split it into two fields one with the date formatted like this: > -M

Re: convert date time

2009-08-21 Thread D'Arcy J.M. Cain
On Fri, 21 Aug 2009 14:43:55 -0400 Ronn Ross wrote: > On Fri, Aug 21, 2009 at 2:26 PM, D'Arcy J.M. Cain wrote: > > You don't say what database you are using but you may find it simpler > > to do the conversion in your SELECT statement. For example, see > > http://www.postgresql.org/docs/8.3/stat

Re: convert date time

2009-08-21 Thread Ronn Ross
On Fri, Aug 21, 2009 at 2:26 PM, D'Arcy J.M. Cain wrote: > On Fri, 21 Aug 2009 14:14:32 -0400 > Ronn Ross wrote: > > I want to split it into two fields one with the date formatted like this: > > -MM-DD 2009-08-02 > > > > and the time to be 24 hour or military time. How every you call it. >

Re: convert date time

2009-08-21 Thread D'Arcy J.M. Cain
On Fri, 21 Aug 2009 14:14:32 -0400 Ronn Ross wrote: > I want to split it into two fields one with the date formatted like this: > -MM-DD 2009-08-02 > > and the time to be 24 hour or military time. How every you call it. Similar > to this: > 15:22:00 > > I found it easy to truncate off the (

convert date time

2009-08-21 Thread Ronn Ross
I'm new to python and I'm getting a date time from a field in the database that looks like this: 8/2/2009 8:36:16 AM (UTC) I want to split it into two fields one with the date formatted like this: -MM-DD 2009-08-02 and the time to be 24 hour or military time. How every you call i

Re: Convert date/time to unix timestamp?

2009-02-10 Thread M.-A. Lemburg
On 2009-02-10 10:26, Phillip B Oldham wrote: > Is there a simple way to set a date/time and convert it to a unix > timestamp? After some googling I found the following: > > t = datetime.time(7,0,0) > starttime = time.mktime(t.timetuple())+1e-6*t.microsecond > > That seems

Re: Convert date/time to unix timestamp?

2009-02-10 Thread andrew cooke
"naive" and "aware" objects). anyway, ignoring that, i think you need the very useful, but oddly located, calendar.timegm(). andrew Phillip B Oldham wrote: > Is there a simple way to set a date/time and convert it to a unix > timestamp? After some googling I

Re: Convert date/time to unix timestamp?

2009-02-10 Thread Thomas Kraus
Phillip B Oldham schrieb: Is there a simple way to set a date/time and convert it to a unix timestamp? After some googling I found the following: t = datetime.time(7,0,0) starttime = time.mktime(t.timetuple())+1e-6*t.microsecond That seems like very long-winded. Is there an easier way? I&#x

Convert date/time to unix timestamp?

2009-02-10 Thread Phillip B Oldham
Is there a simple way to set a date/time and convert it to a unix timestamp? After some googling I found the following: t = datetime.time(7,0,0) starttime = time.mktime(t.timetuple())+1e-6*t.microsecond That seems like very long-winded. Is there an easier way? I've read the docs on the dat

Re: parse date/time from a log entry with only strftime (and no regexen)

2009-02-05 Thread Simon Mullis
That, my friend, is ingenious...! Thankyou SM 2009/2/3 andrew cooke > > > ValueError: unconverted data remains: this is the remainder of the log > > > > line > > > that I do not care about > > you could catch the ValueError and split at the ':' in the .args > attribute to find the extra data.

Re: parse date/time from a log entry with only strftime (and no regexen)

2009-02-03 Thread andrew cooke
> > ValueError: unconverted data remains:  this is the remainder of the log   > > line > > that I do not care about you could catch the ValueError and split at the ':' in the .args attribute to find the extra data. you could then find the extra data in the original string, use the index to remove

Re: parse date/time from a log entry with only strftime (and no regexen)

2009-02-03 Thread Gabriel Genellina
ot;", line 1, in File "/opt/local/lib/python2.5/_strptime.py", line 333, in strptime data_string[found.end():]) ValueError: unconverted data remains: this is the remainder of the log line that I do not care about If the logfile has fixed width fields, you may ask the use

Re: parse date/time from a log entry with only strftime (and no regexen)

2009-02-03 Thread MRAB
Simon Mullis wrote: > Hi All > > I'm writing a script to help with analyzing log files timestamps and > have a very specific question on which I'm momentarily stumped > > I'd like the script to support multiple log file types, so allow a > strftime format to be passed in as a cli switch (defau

parse date/time from a log entry with only strftime (and no regexen)

2009-02-03 Thread Simon Mullis
Hi All I'm writing a script to help with analyzing log files timestamps and have a very specific question on which I'm momentarily stumped I'd like the script to support multiple log file types, so allow a strftime format to be passed in as a cli switch (default is %Y-%m-%d %H:%M:%S). When i

Re: file date/time on windows

2009-01-28 Thread MRAB
09:00 on 1 June will appear to have been modified at 08:00 if viewed during non-DST! MRAB a écrit : m.banaouas wrote: hi, I noticed recently that the value of file date/time I get with python: time.strftime('%Y-%m-%d %H:%M', time.gmtime(os.stat(fullname).st_mtime)) is forwarding

Re: file date/time on windows

2009-01-28 Thread m.banaouas
puter-folder. I gess that if computers of those users are in different timezones, they could see different file date ? MRAB a écrit : > m.banaouas wrote: >> hi, >> >> I noticed recently that the value of file date/time I get with python: >> time.strftime('%Y-%m-%d

Re: file date/time on windows

2009-01-28 Thread MRAB
m.banaouas wrote: hi, I noticed recently that the value of file date/time I get with python: time.strftime('%Y-%m-%d %H:%M', time.gmtime(os.stat(fullname).st_mtime)) is forwarding by one hour the real file date/time. Example: file A.txt: 2009-01-18 16:13 returned valeur: 2009-01-28

file date/time on windows

2009-01-28 Thread m.banaouas
hi, I noticed recently that the value of file date/time I get with python: time.strftime('%Y-%m-%d %H:%M', time.gmtime(os.stat(fullname).st_mtime)) is forwarding by one hour the real file date/time. Example: file A.txt: 2009-01-18 16:13 returned valeur: 2009-01-28 15:13 Is there a

Re: Converting a time string to a more readable date, time

2008-10-27 Thread Scott David Daniels
Thierry Lam wrote: I have a python time string which has the following value: 1225137896 The above corresponds to 2008/10/27 16:04:56 What can I use to convert 1225137896 to a more readable date, time format? (1) Read Smart Questions [you could at least have told us where this number came

Re: Converting a time string to a more readable date, time

2008-10-27 Thread Benjamin Kaplan
On Mon, Oct 27, 2008 at 4:45 PM, Thierry Lam <[EMAIL PROTECTED]> wrote: > I have a python time string which has the following value: > > 1225137896 > > The above corresponds to 2008/10/27 16:04:56 > > What can I use to convert 1225137896 to a more readable date, tim

Converting a time string to a more readable date, time

2008-10-27 Thread Thierry Lam
I have a python time string which has the following value: 1225137896 The above corresponds to 2008/10/27 16:04:56 What can I use to convert 1225137896 to a more readable date, time format? -- http://mail.python.org/mailman/listinfo/python-list

Re: Intelligent Date & Time parsing

2008-03-10 Thread rockingred
On Mar 7, 5:26 pm, [EMAIL PROTECTED] wrote: > On Mar 7, 4:22 pm, [EMAIL PROTECTED] wrote: > [snip]> Although if I end up writing my own I'll sure use > > datetime.parser.parse to get everything left over once you remove > > I mean dateutil.parser.parse. Tomorrow I'll have to leave off the last > Lu

Logging Date/Time Format

2008-03-10 Thread Robert Rawlins
Hello Guys, I'm using the python logging module, however I'm not happy with the current date/time format which is used to write the timestamp into the log file. I need the logger to write the stamp without the milliseconds appended too it. This is because I use a 3rd party applicatio

Re: Intelligent Date & Time parsing

2008-03-10 Thread Eddie Corns
[EMAIL PROTECTED] writes: >I'm new to python and I was wondering if there are any intelligent >date/time parsing modules out there. I've looked at strptime (or >whichever it is) and mxDateTime from the eGenix package. I need >something to parse user input for a django app,

Re: Intelligent Date & Time parsing

2008-03-09 Thread castironpi
On Mar 8, 12:57 pm, Tim Chase <[EMAIL PROTECTED]> wrote: > > I am a GNU newbie.  (I know C &o.)  Can you point me to a > > place to find the source for 'date'? > > It's part of the GNU Coreutils: > > http://ftp.gnu.org/gnu/coreutils/ > > Within the file, you're likely interested in lib/getdate.* >

Re: Intelligent Date & Time parsing

2008-03-08 Thread Tim Chase
> I am a GNU newbie. (I know C &o.) Can you point me to a > place to find the source for 'date'? It's part of the GNU Coreutils: http://ftp.gnu.org/gnu/coreutils/ Within the file, you're likely interested in lib/getdate.* It helps if you have a working knowledge of Yacc. -tkc -- http://ma

Re: Intelligent Date & Time parsing

2008-03-08 Thread castironpi
On Mar 7, 9:23 pm, [EMAIL PROTECTED] wrote: > I figured I might as well share the code I ended up using, in case > anyone else wants an easy way to get strings to, for instance, SQL- > storable datetimes. > > [EMAIL PROTECTED]:~$ cat test.py > #!/usr/bin/python > from datetime import datetime > imp

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
I figured I might as well share the code I ended up using, in case anyone else wants an easy way to get strings to, for instance, SQL- storable datetimes. [EMAIL PROTECTED]:~$ cat test.py #!/usr/bin/python from datetime import datetime import subprocess def parsedate( date ): p = subprocess.P

Re: Intelligent Date & Time parsing

2008-03-07 Thread castironpi
On Mar 7, 5:00 pm, [EMAIL PROTECTED] wrote: > On Mar 7, 4:35 pm, Jeffrey Froman <[EMAIL PROTECTED]> wrote: > > > [EMAIL PROTECTED] wrote: > > > I need > > > something to parse user input for a django app, and it's awesome to be > > > able to write "last monday", "a year ago", or "10pm tuesday" like

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:35 pm, Jeffrey Froman <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > I need > > something to parse user input for a django app, and it's awesome to be > > able to write "last monday", "a year ago", or "10pm tuesday" like > > PHP's strtotime. > > Django comes with some pretty

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:33 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Mar 7, 5:08 pm, [EMAIL PROTECTED] wrote: > > > I'm new to python and I was wondering if there are any intelligent > > date/time parsing modules out there. I've looked at strptime (or > > whichev

Re: Intelligent Date & Time parsing

2008-03-07 Thread Jeffrey Froman
[EMAIL PROTECTED] wrote: > I need > something to parse user input for a django app, and it's awesome to be > able to write "last monday", "a year ago", or "10pm tuesday" like > PHP's strtotime. Django comes with some pretty handy filters for doing this sort of formatting. Check out the "date", "n

Re: Intelligent Date & Time parsing

2008-03-07 Thread Carl Banks
On Mar 7, 5:08 pm, [EMAIL PROTECTED] wrote: > I'm new to python and I was wondering if there are any intelligent > date/time parsing modules out there. I've looked at strptime (or > whichever it is) and mxDateTime from the eGenix package. I need > something to parse user

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:22 pm, [EMAIL PROTECTED] wrote: [snip] > Although if I end up writing my own I'll sure use > datetime.parser.parse to get everything left over once you remove I mean dateutil.parser.parse. Tomorrow I'll have to leave off the last Lunchtime Guiness. > strings like "this saturday". So it

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:10 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 7, 4:08 pm, [EMAIL PROTECTED] wrote: > > > I'm new to python and I was wondering if there are any intelligent > > date/time parsing modules out there. I've looked at strptime (or > >

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:10 pm, Mike Driscoll <[EMAIL PROTECTED]> wrote: > On Mar 7, 4:08 pm, [EMAIL PROTECTED] wrote: > > > I'm new to python and I was wondering if there are any intelligent > > date/time parsing modules out there. I've looked at strptime (or > >

Re: Intelligent Date & Time parsing

2008-03-07 Thread shakefu
On Mar 7, 4:08 pm, [EMAIL PROTECTED] wrote: > I'm new to python and I was wondering if there are any intelligent > date/time parsing modules out there. I've looked at strptime (or > whichever it is) and mxDateTime from the eGenix package. I need > something to parse user

Re: Intelligent Date & Time parsing

2008-03-07 Thread Mike Driscoll
On Mar 7, 4:08 pm, [EMAIL PROTECTED] wrote: > I'm new to python and I was wondering if there are any intelligent > date/time parsing modules out there. I've looked at strptime (or > whichever it is) and mxDateTime from the eGenix package. I need > something to parse user

Intelligent Date & Time parsing

2008-03-07 Thread shakefu
I'm new to python and I was wondering if there are any intelligent date/time parsing modules out there. I've looked at strptime (or whichever it is) and mxDateTime from the eGenix package. I need something to parse user input for a django app, and it's awesome to be able to write &q

Re: Python ADO Date Time database fields

2008-01-25 Thread John Machin
On Jan 26, 12:48 am, goldtech <[EMAIL PROTECTED]> wrote: > snip > > > > > try this: > > > val = oRS.Fields(dt).Value > > print type(val) > > this gives: > > > print float(val) > > yes, it gives 0.0 > > But there should be a way to print what is *actually in the field*. What is "actually in the f

Re: Python ADO Date Time database fields

2008-01-25 Thread Mike Driscoll
On Jan 25, 7:48 am, goldtech <[EMAIL PROTECTED]> wrote: > snip > > > > > try this: > > > val = oRS.Fields(dt).Value > > print type(val) > > this gives: > > > print float(val) > > yes, it gives 0.0 > > But there should be a way to print what is *actually in the field*. > When I open the DB table i

Re: Python ADO Date Time database fields

2008-01-25 Thread goldtech
snip > > try this: > > val = oRS.Fields(dt).Value > print type(val) this gives: > print float(val) yes, it gives 0.0 But there should be a way to print what is *actually in the field*. When I open the DB table in Access I see: 12:00:00 AM. That's what I want - the value, and the form of th

Re: Python ADO Date Time database fields

2008-01-25 Thread John Machin
On Jan 25, 10:55 am, goldtech <[EMAIL PROTECTED]> wrote: > Hi, > > Given an MS-Access table with a date type field with a value of: > 12:00:00 AM - just"12:00:00 AM", there's nothing else in the field. > > I want to print exactly what's in the field, ie. "12:00:00 AM". What I > get printed is: 12

Re: Python ADO Date Time database fields

2008-01-24 Thread Mike Driscoll
On Jan 24, 5:55 pm, goldtech <[EMAIL PROTECTED]> wrote: > Hi, > > Given an MS-Access table with a date type field with a value of: > 12:00:00 AM - just"12:00:00 AM", there's nothing else in the field. > > I want to print exactly what's in the field, ie. "12:00:00 AM". What I > get printed is: 12/

Python ADO Date Time database fields

2008-01-24 Thread goldtech
Hi, Given an MS-Access table with a date type field with a value of: 12:00:00 AM - just"12:00:00 AM", there's nothing else in the field. I want to print exactly what's in the field, ie. "12:00:00 AM". What I get printed is: 12/30/0/ 00:00:00 I try: import win32com.client from win32.client imp

statistical functions for Date/Time data series

2007-04-26 Thread John Henry
I am looking for a simple Python function for handling a set of time series data. For instance, I might have the following raw data (year's worth): 1/1/200512:00 AM11.24 1/1/200512:10 AM12.31 1/1/200512:20 AM12.06 1/1/200512:30 AM11.

Re: Doing date/time + TZ math in python

2007-01-11 Thread Joshua J. Kugler
[EMAIL PROTECTED] wrote: >> The problem is, how do I create a datetime object and tell it that it's >> America/Anchorage *daylight savings time* instead of whatever the system >> is >> currently set at? pytz only has America/Anchorage, and I saw no way to >> tell it explicitly that the timezone i

Re: Doing date/time + TZ math in python

2007-01-06 Thread [EMAIL PROTECTED]
Joshua J. Kugler wrote: > I've read docs (datetime, time, pytz, mx.DateTime), googled, and > experimented. I still don't know how to accomplish what I want to > accomplish. > > I'm loading up a bunch of date/time data that I then need to do math on to > compar

Doing date/time + TZ math in python

2007-01-05 Thread Joshua J. Kugler
I've read docs (datetime, time, pytz, mx.DateTime), googled, and experimented. I still don't know how to accomplish what I want to accomplish. I'm loading up a bunch of date/time data that I then need to do math on to compare it to the current date/time. I can get the current tim

Re: How to find out a date/time difference

2006-05-24 Thread Klaus Alexander Seistrup
Nico Grubert skrev: > you could do this: > > >>> a = datetime.datetime(2006, 5, 24, 16, 1, 26) > >>> b = datetime.datetime(2006, 5, 20, 12, 1, 26) > >>> a-b > datetime.timedelta(4) > # 4 days Or #v+ >>> print (a-b).days 4 >>> #v- Mvh, -- Klaus Alexander Seistrup SubZeroNet, Copenhagen, De

Re: How to find out a date/time difference

2006-05-24 Thread [EMAIL PROTECTED]
And if you want the number of days: py> d = datetime.datetime(2006,5,24,16,34) - datetime.datetime(2006,5,23,12,1) py> d.days 1 py> d = datetime.datetime(2006,5,24,16,34) - datetime.datetime(2006,5,23,19,1) py> d.days 0 -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out a date/time difference

2006-05-24 Thread Nico Grubert
> I use datetime class in my program and now > I have two fields that have the datetime format like this > datetime.datetime(2006, 5, 24, 16, 1, 26) > How can I find out the date/time difference ( in days) of such two > fields? Hi Lad, you could do this: >>> a

Re: How to find out a date/time difference

2006-05-24 Thread Klaus Alexander Seistrup
Lad skrev: > How can I find out the date/time difference ( in days) of such > two fields? Did you try to subtract one value from the other? Mvh, -- Klaus Alexander Seistrup SubZeroNet, Copenhagen, Denmark http://magnetic-ink.dk/ -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find out a date/time difference

2006-05-24 Thread SaskMan
Convert datetime.datetime(2006, 5, 24, 16, 1, 26) to an ordinal number like: datetime.datetime(2006, 5, 24, 16, 1, 26).toordinal() and subtract them to get number of days. -- http://mail.python.org/mailman/listinfo/python-list

How to find out a date/time difference

2006-05-24 Thread Lad
I use datetime class in my program and now I have two fields that have the datetime format like this datetime.datetime(2006, 5, 24, 16, 1, 26) How can I find out the date/time difference ( in days) of such two fields? Thank you for help? L -- http://mail.python.org/mailman/listinfo/python

Re: Is it possible to set the date/time of a directory in windows with Python? If so how?

2006-05-13 Thread ToddLMorgan
Thanks very much for that roger :-) I changed my code to filehandle = win32file.CreateFile(file, win32file.GENERIC_WRITE, win32file.FILE_SHARE_WRITE, None, win32con.OPEN_ALWAYS, win32con.FILE_FLAG_BACKUP_SEMANTICS, None) nowWin32=pywintypes.Time(theTime)

Re: Is it possible to set the date/time of a directory in windows with Python? If so how?

2006-05-13 Thread Roger Upole
"ToddLMorgan" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I'm trying to set any of the dates (create, modification, access) of a > directory under windows with python. > > I'm trying to do this as I'm trying to write a unittest for a directory > cleaning script I'm writing (ie I n

Is it possible to set the date/time of a directory in windows with Python? If so how?

2006-05-13 Thread ToddLMorgan
I'm trying to set any of the dates (create, modification, access) of a directory under windows with python. I'm trying to do this as I'm trying to write a unittest for a directory cleaning script I'm writing (ie I need the test to set the create/mod time for some of the directories so that I can b

Re: Parsing a date-time string?

2005-12-23 Thread linda.s
Hi, I got the message of "There was an error in the DDE conversation with Pythonwin" when I tried to run Pythonwin. I googled and found the possible solution is: modify the Pythonwin shortcut to pass a "/nodde" command-line option. I got lost how to do that. Thanks for any help! -- http://mail.pyt

RE: Parsing a date-time string?

2005-12-23 Thread Leeuw van der, Tim
van der, Tim Cc: python-list@python.org Subject: Re: Parsing a date-time string?     On 21 Dec 2005 01:43:13 -0800, Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote: Hi, I want to parse strings containing date-time, which look like the following: "Mon Dec 19 11:06:12:333 CET 200

Re: Parsing a date-time string?

2005-12-23 Thread Tim Roberts
"Tim N. van der Leeuw" <[EMAIL PROTECTED]> wrote: > >I want to parse strings containing date-time, which look like the >following: > > "Mon Dec 19 11:06:12:333 CET 2005" > >That's a problem for strptime it seems, b/c I cannot find any >forma

Re: Parsing a date-time string?

2005-12-22 Thread Tim Williams (gmail)
On 21 Dec 2005 01:43:13 -0800, Tim N. van der Leeuw <[EMAIL PROTECTED]> wrote: Hi,I want to parse strings containing date-time, which look like thefollowing: "Mon Dec 19 11:06:12:333 CET 2005"[snipped]What I want to get is some sort of sortable date; either as a number or(if no

Re: Parsing a date-time string?

2005-12-22 Thread Tim N. van der Leeuw
I downloaded the tar.bz2 file, extracted it, and had no problem building it and creating a windows installer using 'python ./setup.py bdist_wininst' This windows installer I then used to install it via the 'official windows' way :) luck, --Tim -- http://mail.python.org/mailman/listinfo/python-

Re: Parsing a date-time string?

2005-12-21 Thread Murtog (sent by Nabble.com)
y_number = s[3] In [9]: time = s[4] In [10]: # ? So you treat the datetime information using regex or another split method. Cheers =] Sent from the Python - python-list forum at Nabble.com: Re: Parsing a date-time string? -- http://mail.python.org/mailman/listinfo/python-list

Re: Parsing a date-time string?

2005-12-21 Thread linda.s
I did check and found 'dateutil' is under the folder of python-dateutil-1.0 very confused, :( On 12/21/05, linda.s <[EMAIL PROTECTED]> wrote: > Hi Fuzzyman, > I also wanted to install the DateUtil module from > http://labix.org/python-dateutil > but had problems (using Windows). > C:\Python24>pyth

Re: Parsing a date-time string?

2005-12-21 Thread linda.s
Hi Fuzzyman, I also wanted to install the DateUtil module from http://labix.org/python-dateutil but had problems (using Windows). C:\Python24>python python-dateutil-1.0\setup.py build running build running build_py error: package directory 'dateutil' does not exist Can you tell me why? Linda On 21

Re: Parsing a date-time string?

2005-12-21 Thread Fuzzyman
Quick response - there is a DateUtil module with a *very* flexible string-to-date parser. It will almost certainly do what you want : http://labix.org/python-dateutil All the best, Fuzzyman http://www.voidspace.org.uk/python/index.shtml -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >