Fredrik Lundh wrote:
Henry Chang wrote:
>Instead of getting integers with weekday(), Monday == 0 ... Sunday == 6; is there a way to get the actual names, such as "Monday ... Sunday"? I would like to do this without creating a data mapping. :)
if you have a datetime or date object, you can use strftime with the
appropriate formatting code. see the library reference for details.
if you have the weekday number, you can use the calender module:
>import calendar calendar.day_name[0]
'Monday'
(the latter also contains abbreviated day names, month names, and a
bunch of other potentially useful functions and mappings.)
</F>
-- http://mail.python.org/mailman/listinfo/python-list
Hi,
I've tried calendar.month_name[0], it displays empty string, while
calendar.month_name[1] is "January"? Why does calendar.month_name's
index not start with index 0 as calendar.day_name?
Thanks,
Sophon 3 8249
On Sep 17, 10:20*pm, Keo Sophon <keosop...@gmail.comwrote:
Fredrik Lundh wrote:
Henry Chang wrote:
Instead of getting integers with weekday(), Monday == 0 ... Sunday==
6; is there a way to get the actual names, such as "Monday ...
Sunday"? I would like to do this without creating a data mapping. :)
if you have a datetime or date object, you can use strftime with the
appropriate formatting code. see the library reference for details.
if you have the weekday number, you can use the calender module:
>>import calendar
>>calendar.day_name[0]
'Monday'
(the latter also contains abbreviated day names, month names, and a
bunch of other potentially useful functions and mappings.)
</F>
-- http://mail.python.org/mailman/listinfo/python-list
Hi,
I've tried calendar.month_name[0], it displays empty string, while
calendar.month_name[1] is "January"? Why does calendar.month_name's
index not start with index 0 as calendar.day_name?
Because there's no month 0?
And technically, weeks begin on Sunday, not Monday, but business
likes to think of Monday as day 0 of the week and it doesn't
conflict with any prior date format.
>
Thanks,
Sophon
On Wed, 17 Sep 2008 20:34:02 -0700, Mensanator wrote:
And technically, weeks begin on Sunday, not Monday, but business likes
to think of Monday as day 0 of the week and it doesn't conflict with any
prior date format.
There's no "technically" about it. It's an arbitrary starting point, and
consequently there are different traditions to it, even in English.
Besides, I don't think many businesses think of "day 0" at all. Most
people outside of IT start counting from 1, not 0.
In British Commonwealth countries, Sunday is the last day of the week,
not the first, although under American influence that's changing in
Australia at least.
In Poland, the week begins with Monday ("poniedziaĆek"). Tuesday,
"wtorek", means "second day". Other Slavic countries also start with
Monday.
Similarly, the Lithuanian calendar simple enumerates the days of the
week, starting with Monday, "pirmadienis" ("first day").
In China, there are at least three different systems of naming the week
days. In two of them, the week starts with Sunday, but in the third
system, Sunday is "zhoumo" ("cycle's end") and Monday is zhouyi ("first
of cycle").
--
Steven
On Sep 18, 12:01*am, Steven D'Aprano
<ste...@REMOVE.THIS.cybersource.com.auwrote:
On Wed, 17 Sep 2008 20:34:02 -0700, Mensanator wrote:
And technically, weeks begin on Sunday, not Monday, but business likes
to think of Monday as day 0 of the week and it doesn't conflict with any
prior date format.
There's no "technically" about it.
Sure there is, within the tradition I was refering to.
Within that tradition, the start of the week isn't arbitray.
Besides, the documentation specifically says it's using
the European system
<quote>
By default, these calendars have Monday as the first day
of the week, and Sunday as the last (the European convention).
Use setfirstweekday() to set the first day of the week to
Sunday (6) or to any other weekday.
</quote>
So, by default, Python doesn't use the American convention
of weeks starting on Sunday (an American technicality).
This does not contradict what I said.
It's an arbitrary starting point,
Amongst different systems, it's never arbitrary within a system.
and
consequently there are different traditions to it, even in English.
I know, that's why I added the caveat.
>
Besides, I don't think many businesses think of "day 0" at all. Most
people outside of IT start counting from 1, not 0.
The accounting software I use to fill out my timesheet
electronically was obviously created by IT people and
the week begins on Monday. Their will is, of course,
forced on all employees whether they are IT or not.
>
In British Commonwealth countries, Sunday is the last day of the week,
not the first, although under American influence that's changing in
Australia at least.
In Poland, the week begins with Monday ("poniedziałek"). Tuesday,
"wtorek", means "second day". Other Slavic countries also start with
Monday.
Similarly, the Lithuanian calendar simple enumerates the days of the
week, starting with Monday, "pirmadienis" ("first day").
In China, there are at least three different systems of naming the week
days. In two of them, the week starts with Sunday, but in the third
system, Sunday is "zhoumo" ("cycle's end") and Monday is zhouyi ("first
of cycle").
Last time I was in Borders, I don't recall seeing any
Polish, Lithuanian or Chinese calendars for sale.
>
--
Steven
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Andre |
last post by:
Hello all,
In my database I have a table with records. (Yes I have!!)
Last week a record is changed, but I want to know on which date/time
that was.
Is there a oracle field in the table (like...
|
by: Christopher W. Douglas |
last post by:
I am writing a VB.NET application in Visual Studio 2003. I have written a
method that handles several events, such as closing a form and changing the
visible status of a form. I have some code...
|
by: PamelaDV |
last post by:
I have two problems, actually. I am looking to see if there is a
function that will return the day of the week (Monday, Tuesday,
Wednesday, etc...) from a date. For instance 2/27/04 is a Friday....
|
by: Guoqi Zheng |
last post by:
I know now.dayofweek can return week name, but it is something like, monday,
tuesday, I only need to return Mon to represent monday. And for month
name, I only need to have jan, Feb, etc. short...
|
by: Developer in California |
last post by:
I am working on developing a generic Web framework using Master Pages in
ASP.NET 2.0. What I have done is created a PageRenderer class which has a
public method which will retrieve the path of the...
| |
by: cody |
last post by:
Hi!
we are building an xml-export tool to export our business entities from
out app. we use reflection to determine the data type of properties.
e.g. we have a class Customer with a CustNo...
|
by: Jana |
last post by:
Greetings Access Gurus! I am working on an app to send batch
transactions to our bank, and the bank requires that we place an
effective date on our files that is 'one business day in the future,...
|
by: mix01 |
last post by:
Hi,
I am trying to get some VBA code working, but am preplex as to why it does not work. I would really appreciate any level of help.
Many thanks,
Mix01
Version of the program
|
by: pratapmysql |
last post by:
Hello All,
I am trying to get same day (name) of week of last year in this case date of day is not constraint eg. if december 2007-12-19 day is wednesday ,then last year 2006 wednesday for same is...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |