03/11/2018 08:53 26639
Xử lý date time trong wordpress [Handling date time in wordpress]
timezone_identifiers_list[]: lấy tất cả timezone string
date_default_timezone_get[]:xem thử hiện tại server đang sử dụng default timezone gì
date_default_timezone_set[‘America/Los_Angeles’]: cấn set default time zone ở đầu file để việc xử lý date time được chính xác
date_default_timezone_set['Asia/Ho_Chi_Minh']; |
strtotime[ ‘2018-11-04 15:03:03’]: chuyển dử liệu date time trong mysql về dạng timestamp
date[‘Y-m-d H:i:s’,’1541372583′]: chuyển từ timestamp về date time trong mysql
time[]:lấy timestamp hiện tại
Vòng lặp from date to date trong php
$date='2015-01-01';//start date $end_date='2015-01-31';//end date $dates=array[]; while [strtotime[$date]2015-01-01 [1]=>2015-01-02 [2] =>2015-01-03 [3]=>2015-01-04 [4]=>2015-01-05 [5] =>2015-01-06 [6]=>2015-01-07 [7]=>2015-01-08 [8] =>2015-01-09 [9]=>2015-01-10 [10]=>2015-01-11 [11] =>2015-01-12 [12]=>2015-01-13 [13]=>2015-01-14 [14] =>2015-01-15 [15]=>2015-01-16 [16]=>2015-01-17 [17] =>2015-01-18 [18]=>2015-01-19 [19]=>2015-01-20 [20] =>2015-01-21 [21]=>2015-01-22 [22]=>2015-01-23 [23] =>2015-01-24 [24]=>2015-01-25 [25]=>2015-01-26 [26] =>2015-01-27 [27]=>2015-01-28 [28]=>2015-01-29 [29] =>2015-01-30 [30]=>2015-01-31 ] |
Tính toán date từ ngày hiện tại
date_default_timezone_set['Asia/Ho_Chi_Minh']; $after_day_number=$possible_delivery_time; $after_date=time[]+3*24*60*60; return date["d/m/Y H:i",$after_date]; |
có thể bạn cần xem:
- Disable animation trong revolution slider [ 20/09/2022 08:07 ]
- Cách tạo button printer một element bằng javascript [ 19/09/2022 12:56 ]
- Code sử dụng vue js, quasar, axios, sweetalert2 trong tác vụ quản lý danh sách [ 19/07/2022 10:26 ]
- Hướng dẫn lấy botToken và chatId của bot telegram [ 13/06/2022 13:54 ]
- Tạo thanh bar bottom mobile trong theme wordpress [ 07/06/2022 10:00 ]
- Fix acf not save iframe [ 23/04/2022 07:44 ]
- Rewrite lại url cho page template wordpress [ 21/04/2022 02:11 ]
- Tối ưu hóa cron trong wordpress để website chạy nhanh hơn [ 09/04/2022 03:30 ]
- Function tạo rating star sử dụng dashicon từ wordpress [ 03/04/2022 03:02 ]
- Thêm editor cho mô tả category wordpress [add editor description for category wordpress] [ 01/04/2022 02:02 ]