0

我正在开展一个已经在 2 个国家/地区运行的项目。在我们将项目部署到尼泊尔之前,一切都很好。问题是他们没有使用标准的公历。他们有自己的日历,称为 Bikram Sanwant 日历。我们现有的数据库有 DateTime/Date 列,我不能再使用了,因为他们日历中的几个月有 32 天,根据公历,这不是有效日期。因此,我们考虑将所有日期保存在 3 个不同的列中,例如日、月和年。不仅如此,我们还使用了内置的标准 SQL DateTime 函数,如 DateAdd、DateDiff 等……所以我还必须编写自己的函数并更改所有查询、存储过程和函数。

有谁知道如何处理这个问题或对这个问题有更好的了解?

请提出您的意见和建议。

提前致谢。

4

1 回答 1

0

检查此 php 代码以将 AD 转换为 BS。希望这将有助于您了解更多。

<?php 
    //The Vikram Samvat calendar is 56 years 8 months and 14 days ahead (in count) of the solar Gregorian calendar
    //date_default_timezone_set('Asia/Kathmandu');

    $date = date('Y-m-d');
    $ts1 = strtotime($date);
    $year1 = date('Y', $ts1) + 56;
    $month1 = date('m', $ts1) + 8;
    $day1 = date('d', $ts1) + 14;

    if($month1 >12) {
      $year1 = $year1+1;
      //$remMonth = $month1-12;
      $month1 = $month1-12;
    }

    if($day1 >30) {
       $month1 = $month1+1;
      //$remMonth = $month1-12;
       $day1 = $day1-30;
    }

    //$day1 = date('d', $ts1);
    echo $year1."-".$month1."-".$day1;

?>
于 2016-08-17T13:46:11.483 回答