Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10949
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!69.16.185.21.MISMATCH!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!newspump.sol.net!posts.news.twtelecom.net!nnrp2.twtelecom.net!not-for-mail |
|---|---|
| From | Murta <rodrigomurtax@gmail.com> |
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | IsoWeek Function |
| Date | Mon, 16 Jul 2012 03:45:48 +0000 (UTC) |
| Sender | steve@smc.vnet.net |
| Approved | Steven M. Christensen <steve@smc.vnet.net>, Moderator |
| Message-ID | <ju02pc$48m$1@smc.vnet.net> (permalink) |
| Lines | 24 |
| Organization | Time-Warner Telecom |
| NNTP-Posting-Date | 16 Jul 2012 03:46:02 GMT |
| NNTP-Posting-Host | 08ebce12.news.twtelecom.net |
| X-Trace | DXC=oXmfWDkWS1P[MU5;1DR5I_C_A=>8kQj6];[h;PUXBgbTKLUKTnhj5U]EFiONJ7[GoVW]feZ7O6MQW |
| X-Complaints-To | abuse@twtelecom.net |
| X-Received-Bytes | 1721 |
| Xref | csiph.com comp.soft-sys.math.mathematica:10949 |
Show key headers only | View raw
Hi All
Please, in Mathematica 9 include IsoWeek functions in the standard into DateList and DateString. It would be simple if we have a "ISOWeekYear" and "ISOWeekNumber" as in Oracle and SQL.
Today it's necessary to implemente our own functions, and I get very slow performance results.
I use that to take ISO Week numbers:
ISOWeek[x_]:=Module[{baseDate,year454,weekNames,numWeek},
weekNames={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"};
year454=First@DateList@DatePlus[x,-Position[weekNames,DateString[DatePlus[x,-1],{"DayName"}],1][[1,1]]+4];
baseDate={year454,1,3};
numWeek=IntegerPart[1/7(DateDifference[baseDate,x]+Position[weekNames,DateString[baseDate,{"DayName"}],1][[1,1]]+5)];
{year454,numWeek}
]
Example
ISOWeek["20120101"]
{2011,52}
I tried to compile it, but with no sucess..
Any clue?
Another tip for the developer is create an string "WeekDayNumber", that can return the week day number. Today we have option just to names.
tks in advance
Murta
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
IsoWeek Function Murta <rodrigomurtax@gmail.com> - 2012-07-16 03:45 +0000
csiph-web