Hướng dẫn how do i get specific timezone in python? - làm cách nào để có được múi giờ cụ thể trong python?
Chỉ cần rõ ràng, đây là Python 2.6, tôi đang sử dụng pytz. Show Đây là một ứng dụng chỉ liên quan đến thời gian của chúng tôi, tôi cần có khả năng neo một ngày (hôm nay) và nhận được dấu thời gian UNIX (thời gian epoch) trong 8 giờ tối và 11 giờ tối trong PST. Điều này khiến tôi điên mất.
Vì vậy, mặc dù tôi đang thiết lập một múi giờ và tạo DateTime với múi giờ đó, nhưng nó vẫn tạo nó dưới dạng UTC và sau đó chuyển đổi nó. Đây là một vấn đề nhiều hơn vì UTC sẽ đi trước một ngày khi tôi đang cố gắng thực hiện các tính toán. Có một cách dễ dàng (hoặc ít nhất là nhạy cảm) để tạo dấu thời gian cho 8 giờ tối PST ngày hôm nay? . nhập vào nó.) Eest là +0300 giờ trước UTC Thư viện Python nào được sử dụng cho múi giờ? Mô -đun ZoneInfo cung cấp triển khai múi giờ cụ thể để hỗ trợ cơ sở dữ liệu múi giờ IANA như được quy định ban đầu trong PEP 615. Làm thế nào để có được thời gian hiện tại?Để có được thời gian địa phương, chúng ta có thể sử dụng mô -đun thời gian. Một số chức năng quan trọng của mô -đun thời gian
Làm thế nào để có được thời gian hiện tại trong các khu vực khác nhau?Để có được thời gian hiện tại của một múi giờ cụ thể, cần phải sử dụng thư viện python
Examples:
11:58:190 11:58:191 = 11:58:193 11:58:194 11:58:195 11:58:196 11:58:197 Output: 11:58:19 Chúng tôi sẽ có thời gian hiện tại địa phương của khu vực và các máy tính thời gian UTC tiêu chuẩn: 11:58:198 11:58:199 import Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05301
Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05304 = Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05306 Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05307 = Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05309 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05300 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05301 11:58:196 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05303 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05304 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05305 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05307 11:58:196 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05303 pytz 0Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05305 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 pytz 3
11:58:196 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05303 pytz 9pytz 0Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 pytz 2pytz 3pytz 4
11:58:196 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05303 import 0Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05305 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 import 3pytz 3pytz 4Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+0530 So sánh định dạng UTC và IST của các múi giờ của các khu vực khác nhau: 11:58:198 11:58:199 import Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05301
Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05304 = Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05306 Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05307 = Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05309 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05300 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05301 11:58:196 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05303 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05304 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05305
So sánh định dạng UTC và IST của các múi giờ của các khu vực khác nhau:
Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05309 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05300 ____
Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05309 curr_time 3Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05301
Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05309 curr_time 8Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05301
Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05309 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05301
Output: UTC in Default Format : 2020-03-31 07:15:59.640418+00:00 IST in Default Format : 2020-03-31 12:45:59.692642+05:30 Date & Time in UTC : 2020:03:31 07:15:59 UTC+0000 Date & Time in IST : 2020:03:31 12:45:59 IST+05309 = 8Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05301 11:58:1900 = 11:58:1902 11:58:1903 = 11:58:1905 11:58:1906 = 11:58:1908 11:58:1909____9 11:58:1911 11:58:1912 = 11:58:1914 11:58:196 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05303 11:58:1932 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05301 11:58:196 11:58:1935 11:58:1936 11:58:1937 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1939 pytz 0Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1942 11:58:1936 pytz 411:58:196 11:58:1946 11:58:1936 11:58:1937 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1939 pytz 0Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1942 11:58:1936 pytz 411:58:196 11:58:1957 11:58:1936 11:58:1937 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1939 pytz 0Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1942 11:58:1936 pytz 4
11:58:196 11:58:1968 11:58:1936 11:58:1937 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1939 pytz 0Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1942 11:58:1936 pytz 411:58:196 11:58:1979 11:58:1936 11:58:1937 Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1939 pytz 0Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +05306 11:58:1942 11:58:1936 pytz 4Output: UTC Format IST Format 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 2020-03-31 11:21:13 UTC +0000 2020-03-31 16:51:13 IST +0530 11:58:1915 = 11:58:1917
Thư viện Python nào được sử dụng cho múi giờ?Mô -đun ZoneInfo cung cấp triển khai múi giờ cụ thể để hỗ trợ cơ sở dữ liệu múi giờ IANA như được quy định ban đầu trong PEP 615.zoneinfo module provides a concrete time zone implementation to support the IANA time zone database as originally specified in PEP 615.
Timezone bây giờ () trở lại là gì?Múi giờ.bây giờ () hữu ích.Hàm này trả về ngày và thời gian hiện tại dưới dạng DateTime ngây thơ khi uses_tz = false và dưới dạng dữ liệu nhận thức khi uses_tz = true.Bạn có thể thêm hoặc trừ DateTime.the current date and time as a naive datetime when USE_TZ = False and as an aware datetime when USE_TZ = True . You can add or subtract datetime. |