Re: datetime question

2013-11-12 Thread Mark Lawrence
On 12/11/2013 07:25, alex23 wrote: On 12/11/2013 2:49 PM, Grant Edwards wrote: Don't forget that there are also some differences between American and Imperial whitespace. Since it's ASCII whitespace, you should probably assume American... sys.getsizeof(' ') 34 sys.getsizeof(u' ') 52 bad

Re: datetime question

2013-11-12 Thread Ferrous Cranus
Στις 8/11/2013 11:11 μμ, ο/η Νίκος Αλεξόπουλος έγραψε: Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line manually when time changes? lastvisit = ( datetime.utcnow() + timedelta(hours=2)

Re: datetime question

2013-11-12 Thread Andy Lawton
Firstly , I should clarify I have no idea how to program python, I joined this mailing list in anticipation of learning soon. And thought I'd have a go playing around with your code and code given to you (worst possible place to start, I'm sure) But from the answers already given to you, this

Re: datetime question

2013-11-12 Thread Ferrous Cranus
Στις 12/11/2013 2:47 μμ, ο/η Andy Lawton έγραψε: Firstly , I should clarify I have no idea how to program python, I joined this mailing list in anticipation of learning soon. And thought I'd have a go playing around with your code and code given to you (worst possible place to start, I'm sure)

Re: datetime question

2013-11-12 Thread Joel Goldstick
On Tue, Nov 12, 2013 at 8:32 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: Στις 12/11/2013 2:47 μμ, ο/η Andy Lawton έγραψε: Firstly , I should clarify I have no idea how to program python, I joined this mailing list in anticipation of learning soon. And thought I'd have a go playing around

Re: datetime question

2013-11-12 Thread Ferrous Cranus
Στις 12/11/2013 4:03 μμ, ο/η Joel Goldstick έγραψε: On Tue, Nov 12, 2013 at 8:32 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: Στις 12/11/2013 2:47 μμ, ο/η Andy Lawton έγραψε: Firstly , I should clarify I have no idea how to program python, I joined this mailing list in anticipation of

Re: datetime question

2013-11-12 Thread Roy Smith
In article l5sc04$3vd$1...@reader1.panix.com, Grant Edwards invalid@invalid.invalid wrote: On 2013-11-11, Mark Lawrence breamore...@yahoo.co.uk wrote: On 11/11/2013 23:21, mm0fmf wrote: On 11/11/2013 19:39, Ethan Furman wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov

Re: datetime question

2013-11-12 Thread Chris Angelico
On Wed, Nov 13, 2013 at 1:12 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: Joel i must thank you for your help. I cannot believe it was so simple. Tnhe server is self aware of its location so why use utcnow() + timedelte( some_digit_here ) when you can just use just now() Did you ever go

Re: datetime question

2013-11-12 Thread Ferrous Cranus
Στις 12/11/2013 4:57 μμ, ο/η Chris Angelico έγραψε: On Wed, Nov 13, 2013 at 1:12 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: Joel i must thank you for your help. I cannot believe it was so simple. Tnhe server is self aware of its location so why use utcnow() + timedelte( some_digit_here )

Re: datetime question

2013-11-12 Thread Tim Chase
On 2013-11-12 17:24, Ferrous Cranus wrote: But what of the server was in California and i live in Greece? How would datetime.now() work then? Best practices say to move the value from local time to UTC as soon as possible, then store/use the UTC time internally for all operations. Only when

Re: datetime question

2013-11-12 Thread Ferrous Cranus
Στις 12/11/2013 5:54 μμ, ο/η Tim Chase έγραψε: On 2013-11-12 17:24, Ferrous Cranus wrote: But what of the server was in California and i live in Greece? How would datetime.now() work then? Best practices say to move the value from local time to UTC as soon as possible, then store/use the UTC

Re: datetime question

2013-11-12 Thread Tim Chase
On 2013-11-12 17:57, Ferrous Cranus wrote: Best practices say to move the value from local time to UTC as soon as possible, then store/use the UTC time internally for all operations. Only when it's about to be presented to the user should you convert it back to local time if you need to.

Re: datetime question

2013-11-12 Thread William Ray Wing
On Nov 12, 2013, at 10:57 AM, Ferrous Cranus nikos.gr...@gmail.com wrote: Στις 12/11/2013 5:54 μμ, ο/η Tim Chase έγραψε: On 2013-11-12 17:24, Ferrous Cranus wrote: But what of the server was in California and i live in Greece? How would datetime.now() work then? Best practices say to

Re: datetime question

2013-11-12 Thread Alister
On Tue, 12 Nov 2013 09:54:44 -0600, Tim Chase wrote: On 2013-11-12 17:24, Ferrous Cranus wrote: But what of the server was in California and i live in Greece? How would datetime.now() work then? Best practices say to move the value from local time to UTC as soon as possible, then

Re: datetime question

2013-11-12 Thread Mark Lawrence
On 12/11/2013 16:12, Tim Chase wrote: Regardless of the server's configured TZ, best practice still says to normalize everything to UTC (ESPECIALLY if Greece uses the abomination of DST that we suffer here in the US) as soon as possible and keep it that way for as long as possible. -tkc

Re: datetime question

2013-11-12 Thread MRAB
On 12/11/2013 16:12, Tim Chase wrote: On 2013-11-12 17:57, Ferrous Cranus wrote: Best practices say to move the value from local time to UTC as soon as possible, then store/use the UTC time internally for all operations. Only when it's about to be presented to the user should you convert

Re: datetime question

2013-11-12 Thread Joel Goldstick
On Tue, Nov 12, 2013 at 2:09 PM, MRAB pyt...@mrabarnett.plus.com wrote: On 12/11/2013 16:12, Tim Chase wrote: On 2013-11-12 17:57, Ferrous Cranus wrote: Best practices say to move the value from local time to UTC as soon as possible, then store/use the UTC time internally for all

Re: datetime question

2013-11-12 Thread Denis McMahon
On Tue, 12 Nov 2013 12:47:58 +, Andy Lawton wrote: (I think Europe/Kiev is Greece but I don't know) I suspect Nick is really in a coding sweatshop in Asia/Mumbai -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: datetime question

2013-11-12 Thread Denis McMahon
On Tue, 12 Nov 2013 17:57:55 +0200, Ferrous Cranus wrote: or perhaps by confiruing the timezone of the server to use Greece's TimeZone by issuing a linux command? If you have that degreee of control over the server, yes, but UTC is always safer, because if you need to move your server to a

Re: datetime question

2013-11-12 Thread Chris Angelico
On Wed, Nov 13, 2013 at 6:14 AM, Joel Goldstick joel.goldst...@gmail.com wrote: In the US, the state of Indiana is really weird. Three separate time zone areas, that don't all flip in the same way. See this for TZ hell: http://en.wikipedia.org/wiki/Indiana_time_zones Timezones are one of

Re: datetime question

2013-11-12 Thread Chris Angelico
On Wed, Nov 13, 2013 at 11:30 AM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Tue, 12 Nov 2013 13:02:58 +1100, Chris Angelico ros...@gmail.com declaimed the following: On Tue, Nov 12, 2013 at 12:59 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: Of course, I'm spoiled... My

Re: datetime question

2013-11-12 Thread Roy Smith
In article Eqsgu.53488$F07.39752@fx06.am4, Alister alister.w...@ntlworld.com wrote: Best practices say to move the value from local time to UTC as soon as possible, then store/use the UTC time internally for all operations. Only when it's about to be presented to the user should you

Re: datetime question

2013-11-12 Thread MRAB
On 13/11/2013 00:37, Dennis Lee Bieber wrote: On Wed, 13 Nov 2013 09:42:38 +1100, Chris Angelico ros...@gmail.com declaimed the following: Plus, they switch clocks at 2am all the time, not at 2am forward and 3am backward. 2AM is the time at which US switches occur also, in either

Re: datetime question

2013-11-11 Thread Νίκος Αλεξόπουλος
Στις 8/11/2013 11:11 μμ, ο/η Νίκος Αλεξόπουλος έγραψε: Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line manually when time changes? lastvisit = ( datetime.utcnow() + timedelta(hours=2)

Re: datetime question

2013-11-11 Thread Joel Goldstick
On Mon, Nov 11, 2013 at 4:57 AM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: Στις 8/11/2013 11:11 μμ, ο/η Νίκος Αλεξόπουλος έγραψε: Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line manually

Re: datetime question

2013-11-11 Thread Roy Smith
In article mailman.2377.1384177268.18130.python-l...@python.org, Joel Goldstick joel.goldst...@gmail.com wrote: Why not display UTC? If it is so important to you to display local time, why do you think that your host's local time is something that is useful for a visitor? In general, it

Re: datetime question

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 1:14 AM, Roy Smith r...@panix.com wrote: We've got a data supplier who (for reasons I cannot fathom), runs their network in local time. Every time we talk to them about problems, it's a mess just trying to figure out what time we're talking about. We say, we saw a

Re: datetime question

2013-11-11 Thread Joel Goldstick
So this is a physics joke. The engineers and physicists at the conference went to dinner. They ordered wine with dinner. The wait person asked: Would you like the small liter, or the large liter? -- Joel Goldstick http://joelgoldstick.com --

Re: datetime question

2013-11-11 Thread Denis McMahon
On Mon, 11 Nov 2013 11:57:36 +0200, Νίκος Αλεξόπουλος wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime format Someone has an idea what to add to this line to automatically adjust itself if DST happens? Yes, but the

Re: datetime question

2013-11-11 Thread Ethan Furman
On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, Νίκος Αλεξόπουλος wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime format Someone has an idea what to add to this line to automatically

Re: datetime question

2013-11-11 Thread Grant Edwards
On 2013-11-11, Ethan Furman et...@stoneleaf.us wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, ?? ?? wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime format

Re: datetime question

2013-11-11 Thread rurpy
On Friday, November 8, 2013 3:06:33 PM UTC-7, Joel Goldstick wrote: rurpy? can you help? No, sorry. For your future reference, if there is a question I can help with (have the technical knowledge, haven't seen a good answer yet, have time, etc) I will post my attempt at an answer. So lack

Re: datetime question

2013-11-11 Thread Joel Goldstick
On Mon, Nov 11, 2013 at 5:49 PM, ru...@yahoo.com wrote: On Friday, November 8, 2013 3:06:33 PM UTC-7, Joel Goldstick wrote: rurpy? can you help? No, sorry. For your future reference, if there is a question I can help with (have the technical knowledge, haven't seen a good answer yet, have

Re: datetime question

2013-11-11 Thread mm0fmf
On 11/11/2013 19:39, Ethan Furman wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, Νίκος Αλεξόπουλος wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime format Someone has an idea what

Re: datetime question

2013-11-11 Thread Mark Lawrence
On 11/11/2013 23:21, mm0fmf wrote: On 11/11/2013 19:39, Ethan Furman wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, Νίκος Αλεξόπουλος wrote: lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime

Re: datetime question

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 12:59 PM, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: Of course, I'm spoiled... My /watch/ has a dial for UTC, along with one for 24-hour indication (one hand, range 1 to 24) Heh. Mine doesn't, so I bought myself a second watch and set it to UTC. So my left

Re: datetime question

2013-11-11 Thread Grant Edwards
On 2013-11-11, Mark Lawrence breamore...@yahoo.co.uk wrote: On 11/11/2013 23:21, mm0fmf wrote: On 11/11/2013 19:39, Ethan Furman wrote: On 11/11/2013 11:19 AM, Denis McMahon wrote: On Mon, 11 Nov 2013 11:57:36 +0200, ?? ?? wrote: lastvisit = ( datetime.utcnow()

Re: datetime question

2013-11-11 Thread alex23
On 12/11/2013 2:49 PM, Grant Edwards wrote: Don't forget that there are also some differences between American and Imperial whitespace. Since it's ASCII whitespace, you should probably assume American... sys.getsizeof(' ') 34 sys.getsizeof(u' ') 52 bad by design --

Re: datetime question

2013-11-11 Thread Chris Angelico
On Tue, Nov 12, 2013 at 6:25 PM, alex23 wuwe...@gmail.com wrote: On 12/11/2013 2:49 PM, Grant Edwards wrote: Don't forget that there are also some differences between American and Imperial whitespace. Since it's ASCII whitespace, you should probably assume American... sys.getsizeof(' ')

Re: datetime question

2013-11-10 Thread Gene Heskett
On Saturday 09 November 2013 19:52:52 Chris Angelico did opine: On Sun, Nov 10, 2013 at 2:39 AM, Gene Heskett ghesk...@wdtv.com wrote: Ya know, folks like Nick would have me signing off. Fortunately there are kill files. But the backscatter he creates I am still forced to read, or more

Re: datetime question

2013-11-10 Thread Chris Angelico
On Sun, Nov 10, 2013 at 11:55 AM, Gene Heskett ghesk...@wdtv.com wrote: On Saturday 09 November 2013 19:52:52 Chris Angelico did opine: :) Don't just thank me, Grant and Roy were key to it too - and the whole there's no shortage of newlines thing started with Steven D'Aprano (I think), and

Re: datetime question

2013-11-10 Thread Gene Heskett
On Sunday 10 November 2013 04:06:06 Chris Angelico did opine: On Sun, Nov 10, 2013 at 11:55 AM, Gene Heskett ghesk...@wdtv.com wrote: On Saturday 09 November 2013 19:52:52 Chris Angelico did opine: :) Don't just thank me, Grant and Roy were key to it too - and the whole there's no

Re: datetime question

2013-11-10 Thread unknown
On Sat, 09 Nov 2013 15:43:53 +0200, Νίκος Αλεξόπουλος wrote: Στις 9/11/2013 2:45 μμ, ο/η Mark Lawrence έγραψε: On 08/11/2013 23:02, Νίκος Αλεξόπουλος wrote: Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm

Re: datetime question

2013-11-09 Thread Mark Lawrence
On 08/11/2013 23:02, Νίκος Αλεξόπουλος wrote: Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you have to rewrite all your code in perl to do this.

Re: datetime question

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 11:45 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Why is Web Security for Dummies missing? Because a Dummy can host a web (all you have to do is invite a spider into your house and let it do the work), but he won't be able to make it secure. Or, more succinctly:

Re: datetime question

2013-11-09 Thread Νίκος Αλεξόπουλος
Στις 9/11/2013 2:45 μμ, ο/η Mark Lawrence έγραψε: On 08/11/2013 23:02, Νίκος Αλεξόπουλος wrote: Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you

Re: datetime question

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 9:29 AM, Grant Edwards invalid@invalid.invalid wrote: It's that global newline shortage again. Just because a few people get killed in a newline mine they all go on strike... It's a conspiracy! The government kills a few miners (with their contrail mind-control stuffo)

Re: datetime question

2013-11-09 Thread Roy Smith
In article mailman.2300.1384009442.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Sat, Nov 9, 2013 at 9:29 AM, Grant Edwards invalid@invalid.invalid wrote: It's that global newline shortage again. Just because a few people get killed in a newline mine they all go

Re: datetime question

2013-11-09 Thread Gene Heskett
On Saturday 09 November 2013 10:33:57 Chris Angelico did opine: On Sat, Nov 9, 2013 at 9:29 AM, Grant Edwards invalid@invalid.invalid wrote: It's that global newline shortage again. Just because a few people get killed in a newline mine they all go on strike... It's a conspiracy! The

Re: datetime question

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 2:39 AM, Gene Heskett ghesk...@wdtv.com wrote: Ya know, folks like Nick would have me signing off. Fortunately there are kill files. But the backscatter he creates I am still forced to read, or more usually skip. Then one of you frustrated standup comics comes along,

datetime question

2013-11-08 Thread Νίκος Αλεξόπουλος
Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line manually when time changes? lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime( '%y-%m-%d %H:%M:%S' )# MySQL datetime

Re: datetime question

2013-11-08 Thread Mark Lawrence
On 08/11/2013 21:11, Νίκος Αλεξόπουλος wrote: Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line manually when time changes? lastvisit = ( datetime.utcnow() + timedelta(hours=2) ).strftime(

Re: datetime question

2013-11-08 Thread Νίκος Αλεξόπουλος
Στις 8/11/2013 11:29 μμ, ο/η Mark Lawrence έγραψε: On 08/11/2013 21:11, Νίκος Αλεξόπουλος wrote: Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line manually when time changes? lastvisit = (

Re: datetime question

2013-11-08 Thread Joel Goldstick
rurpy? can you help? On Fri, Nov 8, 2013 at 5:01 PM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: Στις 8/11/2013 11:29 μμ, ο/η Mark Lawrence έγραψε: On 08/11/2013 21:11, Νίκος Αλεξόπουλος wrote: Is there someway to write the following line even better with the ability to detect daylight

Re: datetime question

2013-11-08 Thread Mark Lawrence
On 08/11/2013 22:01, Νίκος Αλεξόπουλος wrote: Στις 8/11/2013 11:29 μμ, ο/η Mark Lawrence έγραψε: On 08/11/2013 21:11, Νίκος Αλεξόπουλος wrote: Is there someway to write the following line even better with the ability to detect daylight saving time by itself so i don't have to alter the line

Re: datetime question

2013-11-08 Thread Grant Edwards
On 2013-11-08, ?? ?? nikos.gr...@gmail.com wrote: Is there someway to [...] http://stackoverflow.com/[...] I saw the link and i'm wondering if it can be written in 1-liner. Don't get me wrong but i had the lastvisit calculated on 1 statement and i want to retain

Re: datetime question

2013-11-08 Thread Denis McMahon
On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you have to rewrite all your code in perl to do this. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: datetime question

2013-11-08 Thread Νίκος Αλεξόπουλος
Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you have to rewrite all your code in perl to do this. Please tell me and as a git i will provide you

Re: datetime question

2013-11-08 Thread Robert Kern
On 2013-11-08 23:02, Νίκος Αλεξόπουλος wrote: Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you have to rewrite all your code in perl to do this.

Re: datetime question

2013-11-08 Thread Chris Angelico
On Sat, Nov 9, 2013 at 10:02 AM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you have to rewrite all

Re: datetime question

2013-11-08 Thread Mark Lawrence
On 08/11/2013 23:02, Νίκος Αλεξόπουλος wrote: Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you have to rewrite all your code in perl to do this.

Re: datetime question

2009-10-31 Thread Albert Hopkins
On Sat, 2009-10-31 at 10:08 +1100, Ben Finney wrote: The ‘datetime’ module focusses on individual date+time values (and the periods between them, with the ‘timedelta’ type). For querying the properties of the calendar, use the ‘calendar’ module. Yes, it would be nice if the ‘time’,

Re: datetime question

2009-10-31 Thread Ben Finney
Albert Hopkins mar...@letterboxes.org writes: On Sat, 2009-10-31 at 10:08 +1100, Ben Finney wrote: Yes, it would be nice if the ‘time’, ‘datetime’, and ‘calendar’ modules were all much more unified and consumed a common set of primitive date+time types. It's a wart, and fixing it would

Re: datetime question

2009-10-31 Thread Albert Hopkins
On Sat, 2009-10-31 at 20:34 +1100, Ben Finney wrote: Fixing ‘time’, ‘datetime’, and ‘calendar’ was the reason for Python 3? No, it wasn't. Or perhaps you mean that any backward-incompatible change was a reason to have Python 3? Even more firmly no. The extent of changes was severely limited

Re: datetime question

2009-10-31 Thread Victor Subervi
Thanks, Rami, that will work. V On Sat, Oct 31, 2009 at 4:54 AM, Albert Hopkins mar...@letterboxes.orgwrote: On Sat, 2009-10-31 at 20:34 +1100, Ben Finney wrote: Fixing ‘time’, ‘datetime’, and ‘calendar’ was the reason for Python 3? No, it wasn't. Or perhaps you mean that any

Re: datetime question

2009-10-31 Thread Ben Finney
Albert Hopkins mar...@letterboxes.org writes: No, I meant cleaning up the standard library in spite of incompatibilities was one of the goals of Python3 (PEP 3108). Ah, okay. That PEP is “Standard Library Reorganization” URL:http://www.python.org/dev/peps/pep-3108/, and is specifically about

datetime question

2009-10-30 Thread Victor Subervi
Hi; I have this code: today = datetime.date.today() day = today.day mo = today.month yr = today.year Works great. What I need to calculate is the length of days in the given month. How do I do that? TIA, Victor -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime question

2009-10-30 Thread Rami Chowdhury
On Fri, 30 Oct 2009 13:03:32 -0700, Victor Subervi victorsube...@gmail.com wrote: Hi; I have this code: today = datetime.date.today() day = today.day mo = today.month yr = today.year Works great. What I need to calculate is the length of days in the given month. How do I do that? TIA,

Re: datetime question

2009-10-30 Thread Ben Finney
Victor Subervi victorsube...@gmail.com writes: What I need to calculate is the length of days in the given month. How do I do that? The ‘datetime’ module focusses on individual date+time values (and the periods between them, with the ‘timedelta’ type). For querying the properties of the

datetime question

2009-03-06 Thread jyoung79
Just curious if this is the best way to get the first 3 letters of the current month? import datetime d = datetime.date.today() m = d.strftime(%B)[:3].upper() m 'MAR' Thanks. Jay -- http://mail.python.org/mailman/listinfo/python-list

Re: datetime question

2009-03-06 Thread Chris Rebert
On Fri, Mar 6, 2009 at 7:24 AM, jyoun...@kc.rr.com wrote: Just curious if this is the best way to get the first 3 letters of the current month? import datetime d = datetime.date.today() m = d.strftime(%B)[:3].upper() m 'MAR' I believe you want the lowercase version, %b (Locale’s

RE: Noob | datetime question

2006-11-14 Thread Demel, Jeff
Perfect. Thanks a million. .strftime was the method I was looking for. -Jeff -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kevin Kelley Sent: Tuesday, November 14, 2006 9:34 AM To: python-list@python.org Subject: Re: Noob | datetime question

Re: Noob | datetime question

2006-11-14 Thread Kevin Kelley
import timeFORMAT='%Y%m%d'time.strftime(FORMAT,time.gmtime(time.time()+8380800))output = '20070219'--Kevin KelleyOn 11/14/06, Demel, Jeff [EMAIL PROTECTED] wrote: I'm having trouble finding exactly what I need by googling, so thoughtI'd try to get a quick answer from the group.This seems like

Re: Noob | datetime question

2006-11-14 Thread Carsten Haese
On Tue, 2006-11-14 at 09:33 -0600, Kevin Kelley wrote: import time FORMAT='%Y%m%d' time.strftime(FORMAT,time.gmtime(time.time()+8380800)) output = '20070219' While the above works, the following variation using datetime is more readable: import datetime someday = datetime.date.today() +

Noob | datetime question

2006-11-14 Thread Demel, Jeff
I'm having trouble finding exactly what I need by googling, so thought I'd try to get a quick answer from the group. This seems like something that should be dead simple. I need to generate a string value of a date in the format MMDD that is 97 days in the future. The datetime module is

Re: Noob | datetime question

2006-11-14 Thread [EMAIL PROTECTED]
On Nov 14, 4:22 pm, Demel, Jeff [EMAIL PROTECTED] wrote: I'm having trouble finding exactly what I need by googling, so thought I'd try to get a quick answer from the group. This seems like something that should be dead simple. I need to generate a string value of a date in the format

Datetime question

2006-08-03 Thread Lad
In a datetime object I would like to change days and hours. Or in other words, I would like to copy this datetime object but increase days and hours. Is it possible? For example:If I have a datetime object like this datetime.datetime(2006, 8, 3, 14, 13, 56, 609000) I would like to make a new ,for

Re: Datetime question

2006-08-03 Thread Rama
the datetime object appears to have a replace method which could achieve what you want to do, albeith with some computation from your end first, d = datetime.datetime(2006, 8, 3, 14, 13, 56, 609000) dir(d)['__add__', '__class__', '__delattr__', '__doc__', '__eq__', '__ge__', '__getattribute__',

Re: Datetime question

2006-08-03 Thread Marc 'BlackJack' Rintsch
In [EMAIL PROTECTED], Lad wrote: In a datetime object I would like to change days and hours. Or in other words, I would like to copy this datetime object but increase days and hours. Is it possible? For example:If I have a datetime object like this datetime.datetime(2006, 8, 3, 14, 13, 56,

Re: Datetime question

2006-08-03 Thread Diez B. Roggisch
Lad schrieb: In a datetime object I would like to change days and hours. Or in other words, I would like to copy this datetime object but increase days and hours. Is it possible? For example:If I have a datetime object like this datetime.datetime(2006, 8, 3, 14, 13, 56, 609000) I would

Re: Datetime question

2006-08-03 Thread Rama
In a datetime object I would like to change days and hours.you'd been pointed to the resources yesterday - please read manuals carefully!a = datetime.datetime(2006, 8, 12, 10, 13, 56, 609000)b = a + datetime.timedelta(days=-2, hours=-4) Newbie Question But wont this create a new object?

Re: Datetime question

2006-08-03 Thread Simon Brunning
On 8/3/06, Rama [EMAIL PROTECTED] wrote: But wont this create a new object? Whereas if you want to modify the same object, should we not be using replace? Or does it not matter in the global picture? datetime objects are immutable. You can't change the value of an existing datetime object,

Re: Datetime question

2006-08-03 Thread Rama
datetime objects are immutable. You can't change the value of anexisting datetime object, only create a new one. Um.. then how do I get the same ID when I call the replace method? a = datetime.datetime(2006, 8, 12, 10, 13, 56, 609000) b = a + datetime.timedelta(days=-2, hours=-4)

Re: Datetime question

2006-08-03 Thread Simon Brunning
On 8/3/06, Rama [EMAIL PROTECTED] wrote: Just curious why when I call id(a) I get the same id after I call the replace method. In your example, you called a's replace() method, but did nothing with the new datetime object that it returned. The original object, a, naturally still has the same

Re: Datetime question

2006-08-03 Thread Rama
Ah, true. Sorry. I got thrown by the ouput after the line got executed and assumed it was the value of a. thanks, Rama On 03/08/06, Simon Brunning [EMAIL PROTECTED] wrote: On 8/3/06, Rama [EMAIL PROTECTED] wrote: Just curious why when I call id(a) I get the same id after I call the replace

Re: datetime question

2006-04-19 Thread Philippe Martin
:-) Thanks. Philippe Scott David Daniels wrote: Jorge Godoy wrote: Philippe Martin wrote: I need to get the date and time under Windows and Linux but need the information visible to the user (cannot find my words) not the sytem information (ex: a PC setup on greenwich but the date/time

datetime question

2006-04-18 Thread Philippe Martin
Hi, I need to get the date and time under Windows and Linux but need the information visible to the user (cannot find my words) not the sytem information (ex: a PC setup on greenwich but the date/time displayed are relative to some other place. Regards, Philippe --

Re: datetime question

2006-04-18 Thread Jorge Godoy
Philippe Martin wrote: Hi, I need to get the date and time under Windows and Linux but need the information visible to the user (cannot find my words) not the sytem information (ex: a PC setup on greenwich but the date/time displayed are relative to some other place. Something like this?

Re: datetime question

2006-04-18 Thread Philippe Martin
Thanks, yes, I guess the question is ... what date/time is it looking at ? and is it the same under various OSs ? Philippe Jorge Godoy wrote: Philippe Martin wrote: Hi, I need to get the date and time under Windows and Linux but need the information visible to the user (cannot find my

Re: datetime question

2006-04-18 Thread Scott David Daniels
Jorge Godoy wrote: Philippe Martin wrote: I need to get the date and time under Windows and Linux but need the information visible to the user (cannot find my words) not the sytem information (ex: a PC setup on greenwich but the date/time displayed are relative to some other place.