代码拉取完成,页面将自动刷新
using System;
using System.Globalization;
namespace Algorithms.Other;
/// <summary>
/// Date of Easter calculated with Meeus's Julian algorithm.
/// The algorithm is described in Jean Meeus' <a href="https://archive.org/details/astronomicalalgorithmsjeanmeeus1991/page/n73/mode/2up">Astronomical Algorithms (1991, p. 69)</a>.
/// </summary>
public static class JulianEaster
{
/// <summary>
/// Calculates the date of Easter.
/// </summary>
/// <param name="year">Year to calculate the date of Easter.</param>
/// <returns>Date of Easter as a DateTime.</returns>
public static DateTime Calculate(int year)
{
var a = year % 4;
var b = year % 7;
var c = year % 19;
var d = (19 * c + 15) % 30;
var e = (2 * a + 4 * b - d + 34) % 7;
var month = (int)Math.Floor((d + e + 114) / 31M);
var day = ((d + e + 114) % 31) + 1;
DateTime easter = new(year, month, day, 00, 00, 00, DateTimeKind.Utc);
return easter;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。