doukuang1950 2019-01-18 11:37
浏览 261

将数据库中的本地时间存储为UTC时间(H:i:s),而不是使用当前时间(H:i:s)查询数据

I am developing a global application with twilio. in that application users store there start_hour and end_hours for there working time with there timezone. when a call comes we query all database and find those buyer who are available in that time. Application timezone is UTC. We need only hours to store and query on hours so we do not need time stamp. The problem is that when we convert user local time to UTC it gets changed Like if buyer choose

with Time zone (Africa/Addis_Ababa)

   Local Time                   UTC time
_____________________     _____________________
Start Hour | End Hour  => Start Hour | End Hour
1:00:00    | 23:00:00  => 22:00:00   | 20:00:00

my query formate in laravel is as

    $this->hours
    ->where('start_time','<=',$currentHour) // Hour 
    ->where('end_time','>',$currentHour)    // Filter

How can I Achieve this any

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 用hfss做微带贴片阵列天线的时候分析设置有问题
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
    • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
    • ¥20 海浪数据 南海地区海况数据,波浪数据
    • ¥20 软件测试决策法疑问求解答