Hi. Are you committed to using the wx routines? If not, here's
something I used to stick in programs just in case I needed it.
________________________________________________________________________
from time import * # "Killing time???" said Tick, the WatchDog.
dpm = [31,28,31,30,31,30,31,31,30,31,30,31] # dpm = Days Per Month
mmm = ["","Jan","Feb","Mar","Apr","May","Jun",
"Jul","Aug","Sep","Oct","Nov","Dec"]
month = ["","January","February","March","April","May","June","July",
"August","September","October","November","December"]
www = ["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]
week = ["Monday","Tuesday","Wednesday","Thursday",
"Friday","Saturday","Sunday"]
# NOTE: Month and mmm have a dummy first element of the list. (It's
# either that, or always remember to subtract one from the month
# returned by the OS.) On the other hand, Monday thru Sunday are 0
# through 6, so no need to have a dummy week[0] element.
# (The above three lines might better be thought of as a class "Months"
# with attributes/characteristics/properties dpm,abbr,name) Maybe I'll
# do that someday.
# Get the current time (year, month, day, hour, minute, second,
# weekday, Julian day and Daylight Savings Time (DST) boolean flag) and
# massage it a few times.
today = localtime(time()) # (yyyy,mm,dd,hh,mm,ss,wd,jd,DST)
right_now = strftime("%a %b %d %H:%M:%S %%s %Y",today) % (tzname[today[8]])
created = strftime("%a. %d %b %Y %H:%M:%S %%s",today) % (tzname[today[8]])
yyyy,mm,dd,hh,nn,ss,wd,jd,dst = today
________________________________________________________________________
I freely admit the variable names aren't great, but now you can play
with Month[mm], mmm[mm], week[wd], and www[wd] to your heart's content.
On Tue, 25 Sep 2001, TH Lim wrote:
> In wxPython API it states that,
>
> wxDateTime::GetWeekDay
> WeekDay GetWeekDay(const TimeZone& tz = Local) const
>
> Returns the week day in the given timezone (local one by default).
>
> That doesn't explain how to get the day of the week from an instance of
> wxDateTime.
>
> Or am I barking at the wrong tree. All I want is to get the day of
> the week whether it is a Sunday. Monday or Tuesday for a given
> instance of wxDateTime.
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users