dounou9751 2016-12-08 10:29
浏览 45

通过IP,纬度和经度获得Zenith值和GMT抵消

I want to use date_sunset and date_sunrise php's functions but the result is not accurate .. I have the user's IP, Longitude, Latitude and i googled how to calculate Zenith value but found nothing.

And the final value in those functions is GMT Offset that i couldn't get it also.

This is available values that i can get for any client and want to use it to get Zenith and GMT Offset ..

geoiprecord Object (

   [country_code] => EG
   [country_code3] => EGY
   [country_name] => Egypt
   [region] => C
   [city] => Cairo
   [postal_code] => 
   [latitude] => 30.0771
   [longitude] => 31.2859
   [area_code] => 
   [dma_code] => 
   [metro_code] => 
   [continent_code] => AF
   [region_name] => Cairo Governorate
   [timezone] => Africa/Cairo

)
  • 写回答

1条回答 默认 最新

  • douye9175 2016-12-08 19:06
    关注

    Just leave the $zenith and $gmt_offset parameters at their defaults. The result of these functions is an integer timestamp which is in terms of UTC. Simply convert the result to the time zone you have in your data "Africa/Cairo".

    See this answer for a good example of how to convert timestamp to a specific time zone in PHP.

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法