Convert between different calendars (Gregorian/Julian) in WinRT… Windows.Globalization.Calendar?

I am looking for a way to convert between the Gregorian and Julian calendars in WinRT.

Usually, I would use DateTime.FromOADate and DateTime.ToOADate, but these methods aren't available. So I found the Windows.Globalization.Calendar type which seems to have some sort of ChangeCalendarSystem method. But who knows how this type works? The method seems to accept something nice, Windows.Globalization.CalendarIdentifiers.Julian, but now I'm beginning to wonder...

And of course, no real docs, no blogs, no nothing - or maybe I'm looking wrong ;)

Can anyone help shed some light on how the type works in this regard, or maybe point me towards the correct types?

Answers


Windows.Globalization.Calendar is the correct thing to use. If you want to convert from Gregorian to Julian, set the calendar system to Gregorian by using ChangeCalendarSystem then set the constituents (starting with largest first: year, month, day,...) to their Gregorian values. Finally, change the calendar system to Julian and then get the constituents.

If you are just wanting to format the value in a different calendar system, you can use the DateTimeFormatter created with the particular calendar system.


Need Your Help

Setting up LAMP using Chef recipe/cookbook

php apache centos chef chef-recipe

I am exploring chef. I want a chef recipe to install apache, mysql, php on centos. I have the chef recipe to install apache on centos. I want a custom recipe to install mysql,php in a single cookbo...

Vertical scroll bar disappeared

php canvas scrollbar facebook-javascript-sdk

The vertical scroll bar in my Facebook application disappeared since this morning. The problem is that I have some pages which the content exceeds the page. So, without the scroll bar I can't see the

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.