DifferenceInDays.cs

namespace WeekOfDay
{
public static class DifferenceInDays
{
public static string GetDifference(DateTime targetDay)
{
var today = DateTime.Today;
TimeSpan difference = today - targetDay;
var str = "dddddd";

return (today > targetDay) ? difference.ToString(str) + "日前"
: (today == targetDay) ? "同日です"
: difference.ToString(str) + "日後";

}
}
}


無料でホームページを作成しよう! このサイトはWebnodeで作成されました。 あなたも無料で自分で作成してみませんか? さあ、はじめよう