Skip to content

Commit

Permalink
Update GetOrder.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Cloud-OG authored May 18, 2024
1 parent 3b7f2c3 commit 1fdaf42
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions Assets/Scripts/GetOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,28 @@ private static int TimeForesee()
{
// 获取当前日期
DateTime currentDate = DateTime.Now;
int hour;

// 创建一个ChineseLunisolarCalendar对象
ChineseLunisolarCalendar chineseCalendar = new ChineseLunisolarCalendar();

// 将当前日期转换为农历日期
int month = chineseCalendar.GetMonth(currentDate);
int day = chineseCalendar.GetDayOfMonth(currentDate);
//换算古代时辰
if (System.DateTime.Now.Hour>=23)

// 获取当前小时
int currentHour = currentDate.Hour;

// 根据当前小时计算古代时辰
int hour;
if (currentHour >= 23 || currentHour < 1)
{
hour = 1;
hour = 1; // 子时
}
else
hour = System.DateTime.Now.Hour/2+2;


{
hour = (currentHour + 1) / 2 + 1;
}

return month + day + hour - 2;
}
}
}

0 comments on commit 1fdaf42

Please sign in to comment.