duanbeng6709 2018-06-19 20:13
浏览 59

Strtotime函数在不同的服务器上返回不同的值

I'm making a calendar and it works perfectly on localhost but not in my server site. I think my problem occurs because of strtotime.

while($rows = sqlsrv_fetch_array($stmt,SQLSRV_FETCH_ASSOC))  
        { 
    $start = strtotime($rows['DATEFROM']) * 1000;
    $end = strtotime($rows['DATETO']) * 1000;
    $calendar[] = array('ID' =>$rows['ID'],
    'start' => "$start",
    'end' => "$end"
        );

this part of code gives;

"start":"1528588800000","end":"1528675200000" 

so events seems in calendar but in my server site I use IIS server and it gives;

 "start":"1528578000000","end":"1528664400000"

so events not seems perfectly.

I searched and most of you said that it occurs of timezone but my localhost timezone and server site timezone is same.It's America/Virginia

I know that php.ini file in localhost says that timezone = UTC but I don't know my IIS Server timezone(when I searched the ISS server use server site time)

localost image: https://i.stack.imgur.com/ZwMgV.jpg

serversite image: https://i.stack.imgur.com/nSNdQ.jpg

database: https://i.stack.imgur.com/IEs5m.jpg

  • 写回答

1条回答 默认 最新

  • douzhang5199 2018-11-05 15:46
    关注

    you server is based in a different location and in a different time zone. If its imperative you have your time simple get the time and add or subtract the difference. I had similar problem with 1and1 internet.

    评论

报告相同问题?

悬赏问题

  • ¥17 pro*C预编译“闪回查询”报错SCN不能识别
  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向