dongyou6768 2019-06-06 03:19
浏览 200

有没有办法改变app.php里面的laravel的默认时区

I have problem regarding to current date, I just wan't to know if the default timezone of laravel in config\app.php can be change based on what timezone i wanted to be.? to understand well, I created this project in asia country but this project based on canada timezone.

Right now my date and time is 05/06/2019 on my laptop so if I used the CURDATE() expression of mysql the date and time will be also 05/06/2019, but the problem when i use the curdate() the output in phpmyadmin is not same on my computer.

Output Curdate

The Question here: If I use the curdate expression, The output of my timezone will be based on current date and time of canada. Is it possible to change it to laravel?

Right now i create an order which the date is 05/06/2019

List of order

I have here my script where I need to select all data based on current date but badly the output is wrong because of timezone.

SELECT op.order_id,op.customer_id,customer_name,customer_number,op.or_number,delivery_status,order_ship_address,delivery_status,order_date,amount,driver_firstname,transaction_number FROM order_properties as op LEFT JOIN (SELECT customer_id,order_id,amount,subtotal FROM payment) p ON op.order_id = p.order_id LEFT JOIN (SELECT customer_id,customer_name,customer_location,customer_number FROM customer_details) cd ON op.customer_id = cd.customer_id LEFT JOIN (SELECT driver_id,driver_firstname FROM driver) drive ON op.driver_id = drive.driver_id WHERE customer_location = '1790' AND DATE(order_date)=CURDATE()

Output of my script

  • 写回答

1条回答 默认 最新

  • dongrong9938 2019-06-06 04:13
    关注

    I just wan't to know if the default timezone of laravel in config\app.php can be change based on what timezone i wanted to be.?

    Yes, you can change the default timezone for your application in the config/app.php

    Canada has a few different timezones. You could pick from any of the following:

    // Mountain ( Alberta )
    'timezone' => 'America/Denver'
    
    // Central ( Saskatchewan, Manitoba )
    'timezone' => 'America/Chicago'
    
    // Eastern ( Ontario, Quebec )
    'timezone' => 'America/New_York'
    
    // Pacific (British Columbia)
    'timezone' => 'America/Los_Angeles'
    

    Browse the list of supported timezones and select the one you want to use.

    You might need to edit your global mysql timezone as well, judging from your comments.

    评论

报告相同问题?

悬赏问题

  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作