Message Boards Message Boards

My “Today's Template” using Mathematica?

Is there a way to recreate what I’m currently doing in Microsoft Word everyday, using the Wolfram Langue and/OR Mathematica to a CDF Printable Format? It’s fairly simple and strait forward. It is a template I use and print for a magnetic whiteboard I use to do videos.

The first number is the year month day displayed in an single eight digit number, the second area is the day of the year / days left in the year, the third is the week number with the day of the week following the ISO standard, the fourth and middle area is the day of the week, month and day, and the year, the fifth is the season and the number of days in that season/ and the days remaining (with the week of that season), the sixth is the current quarter and the days in that quarter / and the days remaining (with the week of that quarter).

This “todays template” works as Monday being the first day of the week.

For obvious reasons I would like to have it be generated automatically, for less obvious reasons I would like it to be formatted and displayed as in the image (if I am able to successfully upload/share it to the Wolfram Community site).

Daily Templage

Now I’m sure this is a simple thing to accomplish but as someone trying to depend less upon Microsoft technologies and more upon Wolfram’s I would greatly appreciate any direction. while this is something I will be attempting to recreate on my own eventually, as I become more accomplished in Mathematica and more specifically the wolfram language, and because the Computable Document Format is just that, computable, would it be possible to have the calculations automatically update within this document format itself triggered from the system clock on my computer?

Or is there some other method someone could suggest? Something that possibly I have not yet considered like doing the calculations in Mathematica or wolfram alfa and having and them just share the data itself to be displayed in template that I've already created on some other document type.

POSTED BY: Brian Woytovich
15 Replies

The first day of spring (according to google) was March 20, which is the same date that my code returns. If I number the days since then, I see this:

In[38]:= days=DateRange[DateObject["March 20, 2017"],DateObject["May 6, 2017"]];
numDay = Range[1,Length[days]];
list=Transpose[{numDay,days}];

In[42]:= list[[#]]&/@ {1,2,3,47,48} // TableForm
Out[42]//TableForm= 
1   Day: Mon 20 Mar 2017
2   Day: Tue 21 Mar 2017
3   Day: Wed 22 Mar 2017
47  Day: Fri 5 May 2017
48  Day: Sat 6 May 2017

I guess you define the first day of spring as day 0? If that's the case, then editing my code is a trivial task. Just offset by the day

POSTED BY: Chad Knutson

Actually I think I misspoke and miscalculated the Days, because it just happened to be in the middle of the season when I checked the code, so when I thought it was giving me the number of days of spring, on this link and compared it to the code, it was actually giving me the number of days REMAINING. So, that being said, the day of spring is not off, but rather those number of days remaining. For instance we show that there are 93 days in spring, not technically, but according to any calendar the way it records it. So, I am not sure how to deal with this if we have to round something or do something in the code to adjust for this. And to your point of starting on the day as Zero, no we actually start as day one, but I think the above explanation explains why I was not explaining what I saw correctly. Hope this clears it up and and makes it more clear as to how we can adjust the code in order make this more inline with any store bought calendar.

enter image description here

Thanks again, and as usual I am starting to really appreciate the code, and have already been feeding it past dates to check on what we call Chrono Labeling records for past dates. Because I can put in any date and it works great!

Thank you as always,

Brian!

POSTED BY: Brian Woytovich

For some reason i am having difficulty copying all the code over correctly, so the email worked, somewhat - will explain, but the code above does not, and i am still getting it a day off, even from the email. For instance today when i put in the date to run the template, i get the following results but according to my calculations its actually the 47th day of spring and 45 days until Summer. and this seems to be the same on websites or even apps you download. they all give me the same results. or some just run a clock and you can round it to the nearest day, but i am not sure how to do this in the wolfram language, to get it accurate to at least the day, not necessarily the minute or hour, just the day.

CreateTemplate[{2017, 5, 6}]

enter image description here

Again, is there anyway you can copy all the code in here so more people can help with it because for some reason i am having difficulty getting all the code copied over. IT's hard to believe this template has been so difficult to create, when someone can download an app today and get all the data, i wounder how they are figuring it, and i would suggest that Wolfram include a season function eventually to make things like this easier. I do truly appreciate everyone's help with this, i never would have guessed that of all things i am tying to do this one would prove to be one of more difficult tasks for us. In fact i have even had trouble making the template a larger size, with an included boarder around the whole thing without other portions being distorted. I do not suppose there is a way to use the manipulate function, or what function could you use, in order to use a slide bar to make the template larger or smaller depending upon what I am using it for. Is that even possible?

In fact eventually during what we call our "Seasonal Migration Cycles" that is the period of time when the season begins but before the next Quarter. we would like the dark background to switch from the Date "Saturday, May 6th, 2017" to the section that will read "Summer 01/??", until which time we enter into the 3rd quarter on the first day of July. and then it would revert back to the same format as before. I just did not want to bring this up at first because its not as necessary, and i though it would confuse the issue, but now that we have gotten this far, i think i will just at least through this out there.

Again I am not sure why the code is not working here, but it dose from my email, so if the whole of the code could be shared that would be great. And maybe eventually with more people chiming in we will eventually accomplish this task, its only been two years attempting it, so i guess i can be patient :)

Thank again for everyone's help.

POSTED BY: Brian Woytovich
Posted 7 years ago

One big challenge for this template is calculating the seasons because Wolfram Language doesn't have this built-in. That said, WL does have functions that can be used to get a very good estimate for season starts. I used SunPosition for my function. I also considered using Sunrise[] and Sunset[], but the granularity of those functions isn't sufficient to find winter and summer start dates.

The following method seems pretty good for the dates I checked, but it is likely not 100% accurate. Here is my code:

estSeason[year_,month_]:=UnixTime[DateObject[{year,month,21}]]

sunAngle[x_?NumericQ]:=
QuantityMagnitude[Last[SunPosition[GeoPosition[{0,0}],FromUnixTime[x],CelestialSystem->"Equatorial"]]]

transitionDate[year_,3]:=
Module[{res},
    res=FindRoot[sunAngle[x]==0,{x,estSeason[year,3]}];
    FromUnixTime[x/. res]
]

transitionDate[year_,6]:=
Module[{res},
    res = FindMaximum[sunAngle[x],{x,estSeason[year,6]}];
    FromUnixTime[x/. Last@res]
]

transitionDate[year_,9]:=
Module[{res},
    res=FindRoot[sunAngle[x]==0,{x,estSeason[year,9]}];
    FromUnixTime[x/. res]
]

transitionDate[year_,12]:=
Module[{res},
    res = FindMinimum[sunAngle[x],{x,estSeason[year,12]}];
    FromUnixTime[x/. Last@res]
]

findNearestTransition[year_,month_,date_DateObject]:=
Module[{possibleDates,candidates},
    possibleDates = Join[DateObject[{year,#,19}]&/@{3,6,9,12},
        DateObject[{year-1,#,19}]&/@{3,6,9,12}];
    candidates=SortBy[{#,Abs[date -#]} &/@ possibleDates,Last][[;;3]];
    First /@ SortBy[candidates,Last]
]

findSeasonsStart[date_DateObject: Today]:=
Module[{year,month,nearestTransitions,seasonChanges,seasonStart,seasonsDef = <|3->"Spring",6->"Summer",9->"Fall",12->"Winter"|>,seasonI,nextSeasonStart},
    {year,month}=DateList[date][[;;2]];
    nearestTransitions = findNearestTransition[year,month,date];
    seasonChanges = Sort[Quiet[transitionDate@@# &/@ (DateList[#][[;;2]]& /@ nearestTransitions)]];
    Which[
        QuantityMagnitude[date-DateObject[DateList[First[seasonChanges]][[;;3]]] ]>=0 &&
        QuantityMagnitude[date-DateObject[DateList[seasonChanges[[2]]][[;;3]]] ]<0,
            seasonI=1,
        QuantityMagnitude[date-DateObject[DateList[seasonChanges[[2]]][[;;3]]] ]>=0 &&
        QuantityMagnitude[date-DateObject[DateList[seasonChanges[[3]]][[;;3]]] ]<0,
            seasonI=2,
        QuantityMagnitude[date-DateObject[DateList[Last[seasonChanges]][[;;3]]] ]>=0,
            seasonI=3
    ];
    seasonStart = seasonChanges[[seasonI]];
    nextSeasonStart = seasonChanges[[seasonI+1]];

    {seasonsDef[DateList[seasonStart][[2]]], 
        ToString[Round@QuantityMagnitude[UnitConvert[date-DateObject[DateList[seasonStart][[;;3]]],"Days"]]+1],
        ToString[Round@QuantityMagnitude[UnitConvert[DateObject[DateList[nextSeasonStart][[;;3]]]-date,"Days"]]-1],
        DateObject[DateList[seasonStart][[;;3]]],DateObject[DateList[nextSeasonStart][[;;3]]]}
]

Some evaluations:

In[17]:= (* used Today as default *)
findSeasonsStart[]
Out[17]= {Spring,36,56,Day: Mon 20 Mar 2017,Day: Tue 20 Jun 2017}

In[33]:= (* select a day with DateObject *)
findSeasonsStart[DateObject[{2017,4,29}]]
Out[33]= {Spring,41,51,Day: Mon 20 Mar 2017,Day: Tue 20 Jun 2017}

I stuffed this code into Sander's code, but this post is getting long enough already. I'll email that to you separately.

POSTED BY: Updating Name

Brian: I did not think the partial solution was neing used. I had continued some work on your question, did not post. Currently don't have access to that code. When I find it I will post from where I stopped work.

But I had same or similar questions as Sander. And the seasons cross years. Depends on where on Earth so to work every where your code would need location if not accessible then set a default location.

POSTED BY: Hans Michel

Now with the new version 11.1 could I get help from the community with my daily template I have been trying to recreate it using Mathematica and Wolfram Language for about a year now. At first I thought I might be having trouble because I did not have the latest version but even now that I have upgraded to 11.1 I’m still having trouble with the two examples given to me, but I must say they got me a lot closer in a short time then I ever thought was possible so quickly, but since then I have been in a stand still.

Would someone look at the following two examples and see what could be tweaked to give me a complete template as shown in my original example from using word, which I have been having to reenter by hand every time I want to reuse it, and see how it can be completed possibly using some of the newest code from Mathematica 11.1 and do we have anything that can work with seasons?

Example by Sander Huisman, when I use it from 11.1

ClearAll[StNdRd, CreateTemplate]
StNdRd[n_String] := 
 If[IntegerQ[ToExpression[n]], StNdRd[ToExpression[n]], ""]
StNdRd[n_Integer] := 
 If[3 < n < 21, "th", 
  Switch[Mod[n, 10], 1, "st", 2, "nd", 3, "rd", _, "th"]]
CreateTemplate[time_: Now] := 
 Module[{t, top, middle, dayofyear, totaldays, week, dayofweek, 
   ordinal, bottom2, Quarterstart, dayofquarter, Quarterend, 
   daysinquarter}, t = Take[DateList[time], 3];
  dayofyear = DateValue[t, "ISOYearDay"];
  totaldays = If[LeapYearQ[t], 366, 365];
  week = DateString[t, "WeekShort"];
  dayofweek = DateString[t, "ISOWeekDay"];
  top = {Style[DateString[t, {"Year", "Month", "Day"}], Bold], 
    Row[{ToString[dayofyear], "/", ToString[totaldays - dayofyear]}], 
    Row[{Style["WK" <> week, Red, Bold], 
      Style["-" <> dayofweek, Bold]}]};
  top = {Row[top, " | "], SpanFromLeft};
  ordinal = StNdRd[DateValue[t, "Day"]];
  middle = {Style[
     DateString[
      t, {"DayName", ", ", "MonthName", " ", "DayShort", ordinal, 
       ", ", "Year"}], White], SpanFromLeft};
  Quarterstart = Take[DateList[t], 2];
  Quarterstart = {First[Quarterstart], 
    Floor[Last[Quarterstart] - 1, 3] + 1, 1};
  Quarterend = Quarterstart;
  Quarterend[[2]] += 3;
  Quarterend = DateList[Quarterend];
  daysinquarter = 
   QuantityMagnitude[DateDifference[Quarterstart, Quarterend], "Day"];
  dayofquarter = 
   QuantityMagnitude[DateDifference[Quarterstart, t, "Day"], "Day"] + 
    1;
  bottom2 = 
   Column[{Row[{DateString[t, {"Quarter"}] <> 
        StNdRd[DateValue[t, "Quarter"]] <> " Quarter ", dayofquarter, 
       "/", daysinquarter - dayofquarter}], 
     Row[{"(", daysinquarter, " Days", " / 13 Weeks)"}]}, "Center"];
  Grid[{top, middle, {Null, bottom2}}, Frame -> All, 
   Background -> {None, {None, Black, None}}]]

CreateTemplate[]
CreateTemplate[{2016, 4, 18}]
CreateTemplate[{1987, 7, 2}]

Which gives me the example for today as... Sander Huisman Result Example when I use it from 11.1

Example by Hans Michel, when I use it from 11.1

SetSystemOptions["DataOptions" -> "ReturnQuantities" -> False];

ISOWeek[x_] := 
  Module[{d2}, 
   d2 = DateList[{ToExpression[
       DateString[
        DatePlus[
         x, {(-(Flatten[
                Position[{"Sunday", "Monday", "Tuesday", "Wednesday", 
                  "Thursday", "Friday", "Saturday"}, 
                 DateString[DatePlus[x, {-1, "Day"}], {"DayName"}], 
                 1]])[[1]] + 4), "Day"}], "Year"]], 1, 3, 0, 0, 0}];
   IntegerPart[(DateDifference[d2, x] + 
       Flatten[Position[{"Sunday", "Monday", "Tuesday", "Wednesday", 
           "Thursday", "Friday", "Saturday"}, 
          DateString[d2, {"DayName"}], 1]][[1]] + 5)/7]];

ISODay = Function[{date}, 
   Flatten[Position[{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"},
       DateString[date, {"DayNameShort"}], 1]][[1]]];

Grid[{{Item[
    Style[DateString[DateList[], {"Year", "", "Month", "", "Day"}], 
     FontFamily -> "Arial Black", FontWeight -> "Black", 
     FontSize -> 32], Alignment -> Center], 
   Item[Style[
     StringJoin[
      ToString[
       IntegerPart[DateDifference[{First[DateList[]]}, DateList[]]]], 
      " / ", 
      ToString[
       IntegerPart[
        DateDifference[DateList[], {Plus[First[DateList[]], 1]}]]]], 
     FontSize -> 28, FontFamily -> "Arial", FontWeight -> Bold], 
    Alignment -> Center], 
   Item[Style[
     Row[{Style[StringJoin["WK", ToString[ISOWeek[DateList[]]]], Red],
        Style[StringJoin["-", 
         ToString[
          NumberForm[ISODay[DateList[]], 
           NumberPadding -> {"0", ""}]]], Black]}], FontSize -> 30, 
     FontFamily -> "Arial Black", FontWeight -> Bold], 
    Alignment -> Center]}, {Item[
    Style[DateString[
      DateList[], {"DayName", ", ", "MonthName", " ", "Day", "th, ", 
       "Year"}], FontSize -> 40, FontFamily -> "Calibri", 
     FontWeight -> Bold, FontColor -> White, Background -> Black], 
    Alignment -> Center, Background -> Black], SpanFromLeft, 
   SpanFromLeft}, {Row[{Item[
      Style["Spring 30/63 (2nd)", FontSize -> 24, 
       FontFamily -> "Arial", FontWeight -> Bold], 
      Alignment -> Center], Spacer[50], 
     Item[Style[
       StringJoin[DateString[DateList[], "Quarter"], "nd", 
        " Quarter ", "18/73 (3rd)"], FontSize -> 24, 
       FontFamily -> "Arial", FontWeight -> Bold], 
      Alignment -> Center]}, Alignment -> Center, Frame -> False], 
   SpanFromLeft, SpanFromLeft}}, Frame -> True, 
 FrameStyle -> Thickness[5], Spacings -> {2, 5}]

Which gives me the example for today as... Hans Michel Result Example when I use it from 11.1

This is what I have been wondering, because I am not sure what will be the most efficient way to create the most accurate templet possible, using the wolfram language, but after reading the most recent post by Stephen Wolfram "The R&D Pipeline Continues: Launching Version 11.1" and updates made to "DateObject" function and granular dates could we use the same thing, or is there something similar for seasons, for timing a season precisely, which as you can see from the two examples we have not yet been able to accomplish. Yet with a more precise time period wouldn't we be able to have the season start and end precisely when spring, in this case starts and ends. Yet in the two examples we could not get the season to work, and personally I would not have a clue how to best accomplish this without a more precise function. This and a more accurate frame as shown in my original post is all that is standing in the way of using the Wolfram Langue over the way I have been doing it for years in word, and would save me a tremendous amount of time and frustration.

Thanks in advance, for any help from the community.

POSTED BY: Brian Woytovich

If I execute my code in 11.1 it executes without any errors, make sure you have a fresh kernel without old definitions still in memory or such...

How do you define the seasons? there are multiple definitions in the world, and some that even change per year... without a definition it is gonna be hard...

POSTED BY: Sander Huisman

Ok, thanks Sander, I will take a look at this further, thanks for the feedback!

POSTED BY: Brian Woytovich

This is great! Thank you both Sander and Brain and to whomever else joins in the assistance with creating this template. I did not expect so much help but only maybe some direction, but this is great! Actually I was already answering Sander by the time Brian had written in but had posted it many hours later before I had a chance to look at yours Brian, the formatting and placement looks great. I'll have to look at the code more closely, and because I am so new it will take me a while, but I like the different approaches so i can better learn this language. Have not yet looked at it in detail but in both cases I am at least getting a better idea. And if anyone else wants to improve upon this even more, it will be welcomed :).

Thanks so much for the community's help on this!

So, currently every day I figure out the numbers by looking at my calendar and adding or subtracting by hand, and only continue to do this because it's become the way I have always done it up to this point. Obviously even if I just have Mathematica give me the numbers each day it would be easier than doing it all myself, and I could even put it myself in a template, but I like the direction that the those who have answered are taking. To keep us on track with what the numbers should be, as of today, I updated what it should read for TODAY (noticing the first image I think was off a bit) figuring it out myself, and I know even using Wolfram Alpha probably would be easier then counting but like I said, you know how you get into the habit of things :(.

Anyway, TODAY's template I think should read the following numbers and also this time included a line through what would be nice but not necessary and what I think my be difficult because of my unique way of calculating this as a "week", but all the other numbers should be exact and easy to calculate each and every day updated, automatically.

Today's Template for Firday, April 29th, 2016 - FROM WORD

POSTED BY: Brian Woytovich

Brian:

I don't have much time to give a proper solution; so as time is ticking I will put what I have so far.

SetSystemOptions["DataOptions" -> "ReturnQuantities" -> False];

ISOWeek[x_] := 
  Module[{d2}, 
   d2 = DateList[{ToExpression[
       DateString[
        DatePlus[
         x, {(-(Flatten[
                Position[{"Sunday", "Monday", "Tuesday", "Wednesday", 
                  "Thursday", "Friday", "Saturday"}, 
                 DateString[DatePlus[x, {-1, "Day"}], {"DayName"}], 
                 1]])[[1]] + 4), "Day"}], "Year"]], 1, 3, 0, 0, 0}]; 
   IntegerPart[(DateDifference[d2, x] + 
       Flatten[Position[{"Sunday", "Monday", "Tuesday", "Wednesday", 
           "Thursday", "Friday", "Saturday"}, 
          DateString[d2, {"DayName"}], 1]][[1]] + 5)/7]];

ISODay = Function[{date}, 
   Flatten[Position[{"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"},
       DateString[date, {"DayNameShort"}], 1]][[1]]];

Grid[{
  {
   Item[Style[
     DateString[DateList[], {"Year", "", "Month", "", "Day"}], 
     FontFamily -> "Arial Black", FontWeight -> "Black", 
     FontSize -> 32], Alignment -> Center],
   Item[Style[
     StringJoin[
      ToString[
       IntegerPart[DateDifference[{First[DateList[]]}, DateList[]]]], 
      " / ", ToString[IntegerPart[
            DateDifference[ DateList[], {Plus[First[DateList[]], 1]}]]]],
      FontSize -> 28, FontFamily -> "Arial", FontWeight -> Bold], 
    Alignment -> Center],
   Item[Style[
     Row[{Style[StringJoin["WK", ToString[ISOWeek[DateList[]]]], Red],
        Style[StringJoin["-", 
         ToString[
          NumberForm[ISODay[DateList[]], 
           NumberPadding -> {"0", ""}]]], Black]}], FontSize -> 30, 
     FontFamily -> "Arial Black", FontWeight -> Bold], 
    Alignment -> Center]
   },
  {
   Item[Style[
     DateString[
      DateList[], {"DayName", ", ", "MonthName", " ", "Day", "th, ", 
       "Year"}], FontSize -> 40, FontFamily -> "Calibri", 
     FontWeight -> Bold, FontColor -> White, Background -> Black], 
    Alignment -> Center, Background -> Black], SpanFromLeft, 
   SpanFromLeft
   }, {
   Row[
    {
     Item[
      Style["Spring 30/63 (2nd)", FontSize -> 24, 
       FontFamily -> "Arial", FontWeight -> Bold], 
      Alignment -> Center], Spacer[50], 
     Item[Style[
       StringJoin[DateString[DateList[], "Quarter"], "nd", 
        " Quarter ", "18/73 (3rd)"], FontSize -> 24, 
       FontFamily -> "Arial", FontWeight -> Bold], Alignment -> Center]
     }, Alignment -> Center , Frame -> False
     ], SpanFromLeft, SpanFromLeft}
  },
  Frame -> True, FrameStyle -> Thickness[5], Spacings -> {2, 5}]

Which would give

enter image description here

The Seasons, Quarters, and dividers need more work. I had a version with Overlay[Grid[]...]. But that was unstable interns of screen resizing. There used to be a package that calculated Seasons

see Scientific Astronomer http://library.wolfram.com/infocenter/Conferences/372/ I attempted to get as close to your original fonts. It would be easier to explicitly state them. My font matching skills are rusty. I'll come back to this later.

POSTED BY: Hans Michel

Thank you, Sander Huisman! Now just to let you know, I am new to the Wolfram Language and I am currently reading; “An Elementary Introduction to the Wolfram Language.” I am extremely impressed with the speed of this community to produce the code requested. Using the code you have provided, I get the following output…

enter image description here

As you can see, the output is different from what you have displayed in you last message. Is there a way to convert it to what you show or am I doing something wrong? Again, I apologize that I’m so green at this! The members in this community have been outstanding with respect to the four questions I have asked to date.

It’s going to be a learning curve for me and my friends as we now try to move our ideas to the Wolfram Cloud while we slowly create each of the solutions we need using the Wolfram Language.

This template is just one of many components of a greater project that I have been working on for over two decades. When I see the code you have written, I am better able to deconstruct it as I learn the language and apply it to other parts of our ongoing project. This question, as it relates to a template for our white board, will move us more towards Wolfram technologies and away from products such as Word, Excel and PowerPoint.

These are probably simple problems for many in this community. I have read some of the impressive profiles of members but for those of us working on our own projects with little background in the Wolfram Language it seems a bit daunting, but we are in this for the long haul!

Thank you,

Brian

POSTED BY: Brian Woytovich

I'm pretty sure you have an older version of Mathematica. I assumed the newest. 2 options: update or change the code...

POSTED BY: Sander Huisman

Sander,

First of all I want to thank you for your time spent on my question for this template. I can see from your profile that you must be very busy and so I do not take it as a light matter that you have taken the time to even help me figure out this code.

Personally, I always want to use the latest version if there is reason, but unfortunately, I do not want to have to spend the extra money for an upgrade if not completely necessary at this time. I first purchased the product, on I believe, November 17th 2014, but have not had the time to use it much after first purchasing it. When I first purchased the product, I thought that it included minor updates.

Could you or someone else confirm that for those of us existing users on Mathematica 10 if upgraded the above code would work moving from 10.0 to the latest 10.4. While I wait for a response I will be trying to learn about the new command differences from 10.0, 10.1, 10.2, 10.3, and 10.4.

Thanks again for your time,

Brian

POSTED BY: Brian Woytovich

Hi Brian,

I made a good start:

ClearAll[StNdRd,CreateTemplate]
StNdRd[n_String]:=If[IntegerQ[ToExpression[n]],StNdRd[ToExpression[n]],""]
StNdRd[n_Integer]:=If[3<n<21,"th",Switch[Mod[n,10],1,"st",2,"nd",3,"rd",_,"th"]]
CreateTemplate[time_:Now]:=Module[{t,top,middle,dayofyear,totaldays,week,dayofweek,ordinal,bottom2,Quarterstart,dayofquarter,Quarterend,daysinquarter},
t=Take[DateList[time],3];
dayofyear=DateValue[t,"ISOYearDay"];
totaldays=If[LeapYearQ[t],366,365];
week=DateString[t,"WeekShort"];
dayofweek=DateString[t,"ISOWeekDay"];
top={Style[DateString[t,{"Year","Month","Day"}],Bold],Row[{ToString[dayofyear],"/",ToString[totaldays-dayofyear]}],Row[{Style["WK"<>week,Red,Bold],Style["-"<>dayofweek,Bold]}]};
top={Row[top," | "],SpanFromLeft};
ordinal=StNdRd[DateValue[t,"Day"]];
middle={Style[DateString[t,{"DayName", ", ","MonthName"," ","DayShort",ordinal,", ","Year"}],White],SpanFromLeft};
Quarterstart=Take[DateList[t],2];
Quarterstart={First[Quarterstart],Floor[Last[Quarterstart]-1,3]+1,1};
Quarterend=Quarterstart;
Quarterend[[2]]+=3;
Quarterend=DateList[Quarterend];
daysinquarter=QuantityMagnitude[DateDifference[Quarterstart,Quarterend],"Day"];
dayofquarter=QuantityMagnitude[DateDifference[Quarterstart,t,"Day"],"Day"]+1;
bottom2=Column[{Row[{DateString[t,{"Quarter"}]<> StNdRd[DateValue[t,"Quarter"]]<>" Quarter ",dayofquarter,"/",daysinquarter-dayofquarter}],Row[{"(",daysinquarter," Days"," / 13 Weeks)"}]},"Center"];
Grid[{top,middle,{Null,bottom2}},Frame->All,Background->{None,{None,Black,None}}]
]

To try out:

CreateTemplate[]
CreateTemplate[{2016, 4, 18}]
CreateTemplate[{1987, 7, 2}]

Giving:

enter image description here

I will leave you with implementation the seasons part, the font-choices, sizes, colors, and exact styling...

POSTED BY: Sander Huisman

Hi Brian,

Pretty much all the pieces of text can be generated using DateString. For the remaining dates of the year/quarter I suggest you use DateDifference. You can use a Grid construct to format it like you have above. It can contain anything and you can set the background to White/Black as you have, also you can merge the cells using SpanFromLeft. You can use Style to style the various colors. If I have some more time, I can give it a try.

--SH

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract