I am writing a WinForms application in C#. It hosts a Web Browser control that will display offline HTML content.
I need to calculate the following:
- Day of the year (1 to 366: 366 for leap years)
- Week of the Year (1 to 52: Didn't check but can some years have a 53rd week?)
Considering that I have access to the DOM, an easy way to do this is what I have done right now:
- Before loading the HTML, replace the markers with calculated values from C# (html = html.Replace("~~~DAYOFYEAR~~~", System.DateTime.Now.SomeProperty);)
- Load the HTML through the DOM
Out of context: