dongzha5934 2015-07-09 12:20
浏览 130
已采纳

MySQL自动递增时发出日期

I have written a sql query to increment 1 year, 10 months, 11 months, and few more date, from the date given. its working fine for every month up to 12th date, when I enter 13th or after 13th date the year will changed to 1971 or 1970. I don't why?

here is my code:

$Domain_Renewal_Date = date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Registered_Date)) ." + 365 day"));
$Alert_Mail_Date= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) ." - 60 day"));
$Alert_Mail_Date1= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 30 day"));
$Alert_Mail_Date2= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 22 day"));
$Alert_Mail_Date3= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 17 day"));
$Alert_Mail_Date4= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 10 day"));
$Alert_Mail_Date5= date("d/m/Y", strtotime(date("d/m/Y", strtotime($Domain_Renewal_Date)) . " - 5 day"));
  • 写回答

2条回答 默认 最新

  • doushi7761 2015-07-09 12:24
    关注

    You have set that date to Unix timestamp, so when you are adding a date and overflows the range, it comes back to 1 January 1970, the date set for that format.

    The maximum date repesentable with that format is Tuesday 2038-01-19.

    I suggest you to change the format of that field.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗