-
-
Notifications
You must be signed in to change notification settings - Fork 91
Expand file tree
/
Copy pathdatetime.po
More file actions
5074 lines (4437 loc) · 207 KB
/
datetime.po
File metadata and controls
5074 lines (4437 loc) · 207 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
# SOME DESCRIPTIVE TITLE.
# Copyright (C) 2001-2026, Python Software Foundation
# This file is distributed under the same license as the Python package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
# Translators:
# Rafael Fontenelle <[email protected]>, 2025
# Freesand Leo <[email protected]>, 2026
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Python 3.12\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2026-01-31 15:51+0000\n"
"PO-Revision-Date: 2025-07-18 19:58+0000\n"
"Last-Translator: Freesand Leo <[email protected]>, 2026\n"
"Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: zh_CN\n"
"Plural-Forms: nplurals=1; plural=0;\n"
#: ../../library/datetime.rst:2
msgid ":mod:`!datetime` --- Basic date and time types"
msgstr ":mod:`!datetime` --- 基本日期和时间类型"
#: ../../library/datetime.rst:11
msgid "**Source code:** :source:`Lib/datetime.py`"
msgstr "**源代码:** :source:`Lib/datetime.py`"
#: ../../library/datetime.rst:17
msgid ""
"The :mod:`!datetime` module supplies classes for manipulating dates and "
"times."
msgstr ":mod:`!datetime` 模块提供了用于操作日期和时间的类。"
#: ../../library/datetime.rst:19
msgid ""
"While date and time arithmetic is supported, the focus of the implementation"
" is on efficient attribute extraction for output formatting and "
"manipulation."
msgstr "在支持日期时间数学运算的同时,实现的关注点更着重于如何能够更有效地解析其属性用于格式化输出和数据操作。"
#: ../../library/datetime.rst:24
msgid "Skip to :ref:`the format codes <format-codes>`."
msgstr "跳到 :ref:`格式代码 <format-codes>`。"
#: ../../library/datetime.rst:28
msgid "Module :mod:`calendar`"
msgstr "模块 :mod:`calendar`"
#: ../../library/datetime.rst:29
msgid "General calendar related functions."
msgstr "通用日历相关函数"
#: ../../library/datetime.rst:31
msgid "Module :mod:`time`"
msgstr "模块 :mod:`time`"
#: ../../library/datetime.rst:32
msgid "Time access and conversions."
msgstr "时间的访问和转换"
#: ../../library/datetime.rst:34
msgid "Module :mod:`zoneinfo`"
msgstr ":mod:`zoneinfo` 模块"
#: ../../library/datetime.rst:35
msgid "Concrete time zones representing the IANA time zone database."
msgstr "代表 IANA 时区数据库的具体时区。"
#: ../../library/datetime.rst:37
msgid "Package `dateutil <https://dateutil.readthedocs.io/en/stable/>`_"
msgstr "`dateutil <https://dateutil.readthedocs.io/en/stable/>`_ 包"
#: ../../library/datetime.rst:38
msgid "Third-party library with expanded time zone and parsing support."
msgstr "具有扩展时区和解析支持的第三方库。"
#: ../../library/datetime.rst:40
msgid "Package :pypi:`DateType`"
msgstr "包 :pypi:`DateType`"
#: ../../library/datetime.rst:41
msgid ""
"Third-party library that introduces distinct static types to e.g. allow "
":term:`static type checkers <static type checker>` to differentiate between "
"naive and aware datetimes."
msgstr ""
"引入了几种独特的静态类型的第三方库,例如允许 :term:`静态类型检查器 <static type checker>` 区分简单型和感知型日期时间。"
#: ../../library/datetime.rst:48
msgid "Aware and Naive Objects"
msgstr "感知型对象和简单型对象"
#: ../../library/datetime.rst:50
msgid ""
"Date and time objects may be categorized as \"aware\" or \"naive\" depending"
" on whether or not they include time zone information."
msgstr "日期和时间对象可以根据它们是否包含时区信息而分为“感知型”和“简单型”两类。"
#: ../../library/datetime.rst:53
msgid ""
"With sufficient knowledge of applicable algorithmic and political time "
"adjustments, such as time zone and daylight saving time information, an "
"**aware** object can locate itself relative to other aware objects. An aware"
" object represents a specific moment in time that is not open to "
"interpretation. [#]_"
msgstr ""
"充分掌握应用性算法和政治性时间调整信息例如时区和夏令时的情况下,一个 **感知型** 对象就能相对于其他感知型对象来精确定位自身时间点。 "
"感知型对象是用来表示一个没有解释空间的固定时间点。 [#]_"
#: ../../library/datetime.rst:59
msgid ""
"A **naive** object does not contain enough information to unambiguously "
"locate itself relative to other date/time objects. Whether a naive object "
"represents Coordinated Universal Time (UTC), local time, or time in some "
"other time zone is purely up to the program, just like it is up to the "
"program whether a particular number represents metres, miles, or mass. Naive"
" objects are easy to understand and to work with, at the cost of ignoring "
"some aspects of reality."
msgstr ""
"**简单型** 对象没有包含足够多的信息来无歧义地相对于其他 date/time 对象来定位自身时间点。 "
"不论一个简单型对象所代表的是世界标准时间(UTC)、当地时间还是某个其他时区的时间完全取决于具体程序,就像一个特定数字所代表的是米、英里还是质量完全取决于具体程序一样。"
" 简单型对象更易于理解和使用,代价则是忽略了某些现实性考量。"
#: ../../library/datetime.rst:66
msgid ""
"For applications requiring aware objects, :class:`.datetime` and "
":class:`.time` objects have an optional time zone information attribute, "
":attr:`!tzinfo`, that can be set to an instance of a subclass of the "
"abstract :class:`tzinfo` class. These :class:`tzinfo` objects capture "
"information about the offset from UTC time, the time zone name, and whether "
"daylight saving time is in effect."
msgstr ""
"对于要求感知型对象的应用,:class:`.datetime` 和 :class:`.time` 对象具有一个可选的时区信息属性 "
":attr:`!tzinfo`,它可被设为抽象类 :class:`tzinfo` 的子类的一个实例。 这些 :class:`tzinfo` 对象会捕获与"
" UTC 时间的差值、时区名称以及夏令时是否生效等信息。"
#: ../../library/datetime.rst:72
msgid ""
"Only one concrete :class:`tzinfo` class, the :class:`timezone` class, is "
"supplied by the :mod:`!datetime` module. The :class:`!timezone` class can "
"represent simple time zones with fixed offsets from UTC, such as UTC itself "
"or North American EST and EDT time zones. Supporting time zones at deeper "
"levels of detail is up to the application. The rules for time adjustment "
"across the world are more political than rational, change frequently, and "
"there is no standard suitable for every application aside from UTC."
msgstr ""
":mod:`!datetime` 模块只提供了一个具体的 :class:`tzinfo` 类,即 :class:`timezone` 类。 "
":class:`!timezone` 类可以表示具有相对于 UTC 的固定时差的简单时区,例如 UTC 本身或北美 EST 和 EDT 时区等。 "
"支持时区的详细程度取决于具体的应用。 世界各地的时间调整规则往往是政治性多于合理性,经常会发生变化,除了 UTC 之外并没有一个能适合所有应用的标准。"
#: ../../library/datetime.rst:81
msgid "Constants"
msgstr "常量"
#: ../../library/datetime.rst:83
msgid "The :mod:`!datetime` module exports the following constants:"
msgstr ":mod:`!datetime` 模块导出了以下常量:"
#: ../../library/datetime.rst:87
msgid ""
"The smallest year number allowed in a :class:`date` or :class:`.datetime` "
"object. :const:`MINYEAR` is 1."
msgstr ":class:`date` 或 :class:`.datetime` 对象允许的最小年份数值。 :const:`MINYEAR` 为 1。"
#: ../../library/datetime.rst:93
msgid ""
"The largest year number allowed in a :class:`date` or :class:`.datetime` "
"object. :const:`MAXYEAR` is 9999."
msgstr ""
":class:`date` 或 :class:`.datetime` 对象允许的最大年份数值。 :const:`MAXYEAR` 为 9999。"
#: ../../library/datetime.rst:98
msgid "Alias for the UTC time zone singleton :attr:`datetime.timezone.utc`."
msgstr "UTC 时区单例 :attr:`datetime.timezone.utc` 的别名。"
#: ../../library/datetime.rst:103
msgid "Available Types"
msgstr "有效的类型"
#: ../../library/datetime.rst:108
msgid ""
"An idealized naive date, assuming the current Gregorian calendar always was,"
" and always will be, in effect. Attributes: :attr:`year`, :attr:`month`, and"
" :attr:`day`."
msgstr ""
"一个理想化的简单型日期,它假设当今的公历在过去和未来永远有效。 属性: :attr:`year`, :attr:`month`, and "
":attr:`day`。"
#: ../../library/datetime.rst:116
msgid ""
"An idealized time, independent of any particular day, assuming that every "
"day has exactly 24\\*60\\*60 seconds. (There is no notion of \"leap "
"seconds\" here.) Attributes: :attr:`hour`, :attr:`minute`, :attr:`second`, "
":attr:`microsecond`, and :attr:`.tzinfo`."
msgstr ""
"一个独立于任何特定日期的理想化时间,它假设每一天都恰好等于 24\\*60\\*60 秒。 (这里没有“闰秒”的概念。) 包含属性: "
":attr:`hour`, :attr:`minute`, :attr:`second`, :attr:`microsecond` 和 "
":attr:`.tzinfo`。"
#: ../../library/datetime.rst:125
msgid ""
"A combination of a date and a time. Attributes: :attr:`year`, :attr:`month`,"
" :attr:`day`, :attr:`hour`, :attr:`minute`, :attr:`second`, "
":attr:`microsecond`, and :attr:`.tzinfo`."
msgstr ""
"日期和时间的结合。属性::attr:`year`, :attr:`month`, :attr:`day`, :attr:`hour`, "
":attr:`minute`, :attr:`second`, :attr:`microsecond`, and :attr:`.tzinfo`."
#: ../../library/datetime.rst:133
msgid ""
"A duration expressing the difference between two :class:`.datetime` or "
":class:`date` instances to microsecond resolution."
msgstr "将两个 :class:`.datetime` 或 :class:`date` 实例之间的差值表示为微秒级精度的持续时间。"
#: ../../library/datetime.rst:140
msgid ""
"An abstract base class for time zone information objects. These are used by "
"the :class:`.datetime` and :class:`.time` classes to provide a customizable "
"notion of time adjustment (for example, to account for time zone and/or "
"daylight saving time)."
msgstr ""
"一个描述时区信息对象的抽象基类。 用来给 :class:`.datetime` 和 :class:`.time` "
"类提供自定义的时间调整概念(例如处理时区和/或夏令时)。"
#: ../../library/datetime.rst:148
msgid ""
"A class that implements the :class:`tzinfo` abstract base class as a fixed "
"offset from the UTC."
msgstr "一个实现了 :class:`tzinfo` 抽象基类的子类,用于表示相对于 世界标准时间(UTC)的偏移量。"
#: ../../library/datetime.rst:153 ../../library/datetime.rst:171
msgid "Objects of these types are immutable."
msgstr "这些类型的对象都是不可变的。"
#: ../../library/datetime.rst:155
msgid "Subclass relationships::"
msgstr "子类关系 ::"
#: ../../library/datetime.rst:157
msgid ""
"object\n"
" timedelta\n"
" tzinfo\n"
" timezone\n"
" time\n"
" date\n"
" datetime"
msgstr ""
"object\n"
" timedelta\n"
" tzinfo\n"
" timezone\n"
" time\n"
" date\n"
" datetime"
#: ../../library/datetime.rst:166
msgid "Common Properties"
msgstr "通用的特征属性"
#: ../../library/datetime.rst:168
msgid ""
"The :class:`date`, :class:`.datetime`, :class:`.time`, and :class:`timezone`"
" types share these common features:"
msgstr ""
":class:`date`, :class:`.datetime`, :class:`.time` 和 :class:`timezone` "
"类型共享这些通用特性:"
#: ../../library/datetime.rst:172
msgid ""
"Objects of these types are :term:`hashable`, meaning that they can be used "
"as dictionary keys."
msgstr "这些类型的对象是 :term:`hashable`,意味着它们可以被用作字典的键。"
#: ../../library/datetime.rst:174
msgid ""
"Objects of these types support efficient pickling via the :mod:`pickle` "
"module."
msgstr "这些类型的对象支持通过 :mod:`pickle` 模块进行高效的封存。"
#: ../../library/datetime.rst:177
msgid "Determining if an Object is Aware or Naive"
msgstr "确定一个对象是感知型还是简单型"
#: ../../library/datetime.rst:179
msgid "Objects of the :class:`date` type are always naive."
msgstr ":class:`date` 类型的对象都是简单型的。"
#: ../../library/datetime.rst:181
msgid ""
"An object of type :class:`.time` or :class:`.datetime` may be aware or "
"naive."
msgstr ":class:`.time` 或 :class:`.datetime` 类型的对象可以是感知型或者简单型。"
#: ../../library/datetime.rst:183
msgid ""
"A :class:`.datetime` object ``d`` is aware if both of the following hold:"
msgstr "一个 :class:`.datetime` 对象 ``d`` 在以下条件同时成立时将是感知型的:"
#: ../../library/datetime.rst:185
msgid "``d.tzinfo`` is not ``None``"
msgstr "``d.tzinfo`` 不为 ``None``"
#: ../../library/datetime.rst:186
msgid "``d.tzinfo.utcoffset(d)`` does not return ``None``"
msgstr "``d.tzinfo.utcoffset(d)`` 不返回 ``None``"
#: ../../library/datetime.rst:188
msgid "Otherwise, ``d`` is naive."
msgstr "在其他情况下,``d`` 将是简单型的。"
#: ../../library/datetime.rst:190
msgid "A :class:`.time` object ``t`` is aware if both of the following hold:"
msgstr "一个 :class:`.time` 对象 ``t`` 在以下条件同时成立时将是感知型的:"
#: ../../library/datetime.rst:192
msgid "``t.tzinfo`` is not ``None``"
msgstr "``t.tzinfo`` 不为 ``None``"
#: ../../library/datetime.rst:193
msgid "``t.tzinfo.utcoffset(None)`` does not return ``None``."
msgstr "``t.tzinfo.utcoffset(None)`` 不返回 ``None``。"
#: ../../library/datetime.rst:195
msgid "Otherwise, ``t`` is naive."
msgstr "在其他情况下,``t`` 将是简单型的。"
#: ../../library/datetime.rst:197
msgid ""
"The distinction between aware and naive doesn't apply to :class:`timedelta` "
"objects."
msgstr "感知型和简单型之间的区别不适用于 :class:`timedelta` 对象。"
#: ../../library/datetime.rst:203
msgid ":class:`timedelta` Objects"
msgstr ":class:`timedelta` 类对象"
#: ../../library/datetime.rst:205
msgid ""
"A :class:`timedelta` object represents a duration, the difference between "
"two :class:`.datetime` or :class:`date` instances."
msgstr ""
":class:`timedelta` 对象表示一段持续的时间,即两个 :class:`.datetime` 或 :class:`date` "
"实例之间的差值。"
#: ../../library/datetime.rst:210
msgid ""
"All arguments are optional and default to 0. Arguments may be integers or "
"floats, and may be positive or negative."
msgstr "所有参数都是可选的并且默认为 0。 这些参数可以是整数或者浮点数,并可以为正值或者负值。"
#: ../../library/datetime.rst:213
msgid ""
"Only *days*, *seconds* and *microseconds* are stored internally. Arguments "
"are converted to those units:"
msgstr "只有 *days*, *seconds* 和 *microseconds* 会存储在内部。 参数单位的换算规则如下:"
#: ../../library/datetime.rst:216
msgid "A millisecond is converted to 1000 microseconds."
msgstr "1毫秒会转换成1000微秒。"
#: ../../library/datetime.rst:217
msgid "A minute is converted to 60 seconds."
msgstr "1分钟会转换成60秒。"
#: ../../library/datetime.rst:218
msgid "An hour is converted to 3600 seconds."
msgstr "1小时会转换成3600秒。"
#: ../../library/datetime.rst:219
msgid "A week is converted to 7 days."
msgstr "1星期会转换成7天。"
#: ../../library/datetime.rst:221
msgid ""
"and days, seconds and microseconds are then normalized so that the "
"representation is unique, with"
msgstr "日期、秒、微秒都是标准化的,所以它们的表达方式也是唯一的,例:"
#: ../../library/datetime.rst:224
msgid "``0 <= microseconds < 1000000``"
msgstr "``0 <= microseconds < 1000000``"
#: ../../library/datetime.rst:225
msgid "``0 <= seconds < 3600*24`` (the number of seconds in one day)"
msgstr "``0 <= seconds < 3600*24`` (一天的秒数)"
#: ../../library/datetime.rst:226
msgid "``-999999999 <= days <= 999999999``"
msgstr "``-999999999 <= days <= 999999999``"
#: ../../library/datetime.rst:228
msgid ""
"The following example illustrates how any arguments besides *days*, "
"*seconds* and *microseconds* are \"merged\" and normalized into those three "
"resulting attributes::"
msgstr ""
"下面的例子演示了如何对 *days*, *seconds* 和 *microseconds* "
"以外的任意参数执行“合并”操作并标准化为以上三个结果属性::"
#: ../../library/datetime.rst:232
msgid ""
">>> from datetime import timedelta\n"
">>> delta = timedelta(\n"
"... days=50,\n"
"... seconds=27,\n"
"... microseconds=10,\n"
"... milliseconds=29000,\n"
"... minutes=5,\n"
"... hours=8,\n"
"... weeks=2\n"
"... )\n"
">>> # Only days, seconds, and microseconds remain\n"
">>> delta\n"
"datetime.timedelta(days=64, seconds=29156, microseconds=10)"
msgstr ""
">>> from datetime import timedelta\n"
">>> delta = timedelta(\n"
"... days=50,\n"
"... seconds=27,\n"
"... microseconds=10,\n"
"... milliseconds=29000,\n"
"... minutes=5,\n"
"... hours=8,\n"
"... weeks=2\n"
"... )\n"
">>> # 只保留日期、秒和微秒\n"
">>> delta\n"
"datetime.timedelta(days=64, seconds=29156, microseconds=10)"
#: ../../library/datetime.rst:246
msgid ""
"If any argument is a float and there are fractional microseconds, the "
"fractional microseconds left over from all arguments are combined and their "
"sum is rounded to the nearest microsecond using round-half-to-even "
"tiebreaker. If no argument is a float, the conversion and normalization "
"processes are exact (no information is lost)."
msgstr ""
"在有任何参数为浮点型并且 microseconds "
"值为小数的情况下,从所有参数中余下的微秒数将被合并,并使用四舍五入偶不入奇的规则将总计值舍入到最接近的整数微秒值。 "
"如果没有任何参数为浮点型的情况下,则转换和标准化过程将是完全精确的(不会丢失信息)。"
#: ../../library/datetime.rst:253
msgid ""
"If the normalized value of days lies outside the indicated range, "
":exc:`OverflowError` is raised."
msgstr "如果标准化后的 days 数值超过了指定范围,将会抛出 :exc:`OverflowError` 异常。"
#: ../../library/datetime.rst:256
msgid ""
"Note that normalization of negative values may be surprising at first. For "
"example::"
msgstr "请注意对负数值进行标准化的结果可能会令人感到惊讶。 例如::"
#: ../../library/datetime.rst:259
msgid ""
">>> from datetime import timedelta\n"
">>> d = timedelta(microseconds=-1)\n"
">>> (d.days, d.seconds, d.microseconds)\n"
"(-1, 86399, 999999)"
msgstr ""
">>> from datetime import timedelta\n"
">>> d = timedelta(microseconds=-1)\n"
">>> (d.days, d.seconds, d.microseconds)\n"
"(-1, 86399, 999999)"
#: ../../library/datetime.rst:265 ../../library/datetime.rst:566
#: ../../library/datetime.rst:1089 ../../library/datetime.rst:1720
#: ../../library/datetime.rst:2322
msgid "Class attributes:"
msgstr "类属性:"
#: ../../library/datetime.rst:269
msgid ""
"The most negative :class:`timedelta` object, ``timedelta(-999999999)``."
msgstr " :class:`timedelta` 类对象的最小值为 ``timedelta(-999999999)``。"
#: ../../library/datetime.rst:274
msgid ""
"The most positive :class:`timedelta` object, ``timedelta(days=999999999, "
"hours=23, minutes=59, seconds=59, microseconds=999999)``."
msgstr ""
" :class:`timedelta` 类对象的最大值为 ``timedelta(days=999999999, hours=23, "
"minutes=59, seconds=59, microseconds=999999)``。"
#: ../../library/datetime.rst:280
msgid ""
"The smallest possible difference between non-equal :class:`timedelta` "
"objects, ``timedelta(microseconds=1)``."
msgstr "两个不相等的 :class:`timedelta` 类对象最小的间隔为 ``timedelta(microseconds=1)``。"
#: ../../library/datetime.rst:283
msgid ""
"Note that, because of normalization, ``timedelta.max`` is greater than "
"``-timedelta.min``. ``-timedelta.max`` is not representable as a "
":class:`timedelta` object."
msgstr ""
"请注意,因为标准化的缘故,``timedelta.max`` 大于 ``-timedelta.min``。 ``-timedelta.max`` "
"不可以表示为一个 :class:`timedelta` 对象。"
#: ../../library/datetime.rst:287 ../../library/datetime.rst:584
#: ../../library/datetime.rst:1109 ../../library/datetime.rst:1740
msgid "Instance attributes (read-only):"
msgstr "实例属性(只读):"
#: ../../library/datetime.rst:291
msgid "Between -999,999,999 and 999,999,999 inclusive."
msgstr "-999,999,999 至 999,999,999 开区间。"
#: ../../library/datetime.rst:296
msgid "Between 0 and 86,399 inclusive."
msgstr "0 至 86,399 开区间。"
#: ../../library/datetime.rst:300
msgid ""
"It is a somewhat common bug for code to unintentionally use this attribute "
"when it is actually intended to get a :meth:`~timedelta.total_seconds` value"
" instead:"
msgstr "一个有点常见的代码错误是当实际是要获取 :meth:`~timedelta.total_seconds` 值时无意中使用了这个属性:"
#: ../../library/datetime.rst:304
msgid ""
">>> from datetime import timedelta\n"
">>> duration = timedelta(seconds=11235813)\n"
">>> duration.days, duration.seconds\n"
"(130, 3813)\n"
">>> duration.total_seconds()\n"
"11235813.0"
msgstr ""
">>> from datetime import timedelta\n"
">>> duration = timedelta(seconds=11235813)\n"
">>> duration.days, duration.seconds\n"
"(130, 3813)\n"
">>> duration.total_seconds()\n"
"11235813.0"
#: ../../library/datetime.rst:315
msgid "Between 0 and 999,999 inclusive."
msgstr "0 至 999,999 开区间。"
#: ../../library/datetime.rst:318 ../../library/datetime.rst:601
#: ../../library/datetime.rst:1162
msgid "Supported operations:"
msgstr "支持的运算:"
#: ../../library/datetime.rst:323 ../../library/datetime.rst:604
#: ../../library/datetime.rst:1165
msgid "Operation"
msgstr "运算"
#: ../../library/datetime.rst:323 ../../library/datetime.rst:604
#: ../../library/datetime.rst:1165
msgid "Result"
msgstr "结果:"
#: ../../library/datetime.rst:325
msgid "``t1 = t2 + t3``"
msgstr "``t1 = t2 + t3``"
#: ../../library/datetime.rst:325
msgid ""
"Sum of ``t2`` and ``t3``. Afterwards ``t1 - t2 == t3`` and ``t1 - t3 == t2``"
" are true. (1)"
msgstr ""
"``t2`` 和 ``t3`` 之和。 运算后 ``t1 - t2 == t3`` 且 ``t1 - t3 == t2`` 为真值。 (1)"
#: ../../library/datetime.rst:329
msgid "``t1 = t2 - t3``"
msgstr "``t1 = t2 - t3``"
#: ../../library/datetime.rst:329
msgid ""
"Difference of ``t2`` and ``t3``. Afterwards ``t1 == t2 - t3`` and ``t2 == "
"t1 + t3`` are true. (1)(6)"
msgstr ""
"``t2`` 和 ``t3`` 之差。 运算后 ``t1 == t2 - t3`` 且 ``t2 == t1 + t3`` 为真值。 (1)(6)"
#: ../../library/datetime.rst:333
msgid "``t1 = t2 * i or t1 = i * t2``"
msgstr "``t1 = t2 * i or t1 = i * t2``"
#: ../../library/datetime.rst:333
msgid ""
"Delta multiplied by an integer. Afterwards ``t1 // i == t2`` is true, "
"provided ``i != 0``."
msgstr "时差乘以一个整数。 运算后如果 ``i != 0`` 则 ``t1 // i == t2`` 为真值。"
#: ../../library/datetime.rst:337
msgid "In general, ``t1 * i == t1 * (i-1) + t1`` is true. (1)"
msgstr "通常情况下,``t1 * i == t1 * (i-1) + t1`` 为真值。 (1)"
#: ../../library/datetime.rst:340
msgid "``t1 = t2 * f or t1 = f * t2``"
msgstr "``t1 = t2 * f or t1 = f * t2``"
#: ../../library/datetime.rst:340
msgid ""
"Delta multiplied by a float. The result is rounded to the nearest multiple "
"of timedelta.resolution using round-half-to-even."
msgstr "乘以一个浮点数,结果会被舍入到 timedelta 最接近的整数倍。 精度使用四舍五偶入奇不入规则。"
#: ../../library/datetime.rst:344
msgid "``f = t2 / t3``"
msgstr "``f = t2 / t3``"
#: ../../library/datetime.rst:344
msgid ""
"Division (3) of overall duration ``t2`` by interval unit ``t3``. Returns a "
":class:`float` object."
msgstr "总时长 ``t2`` 除以间隔单位 ``t3`` (3)。 返回一个 :class:`float` 对象。"
#: ../../library/datetime.rst:348
msgid "``t1 = t2 / f or t1 = t2 / i``"
msgstr "``t1 = t2 / f or t1 = t2 / i``"
#: ../../library/datetime.rst:348
msgid ""
"Delta divided by a float or an int. The result is rounded to the nearest "
"multiple of timedelta.resolution using round-half-to-even."
msgstr "除以一个浮点数或整数。 结果会被舍入到 timedelta 最接近的整数倍。 精度使用四舍五偶入奇不入规则。"
#: ../../library/datetime.rst:352
msgid "``t1 = t2 // i`` or ``t1 = t2 // t3``"
msgstr "``t1 = t2 // i`` or ``t1 = t2 // t3``"
#: ../../library/datetime.rst:352
msgid ""
"The floor is computed and the remainder (if any) is thrown away. In the "
"second case, an integer is returned. (3)"
msgstr "计算底数,其余部分(如果有)将被丢弃。在第二种情况下,将返回整数。 (3)"
#: ../../library/datetime.rst:356
msgid "``t1 = t2 % t3``"
msgstr "``t1 = t2 % t3``"
#: ../../library/datetime.rst:356
msgid "The remainder is computed as a :class:`timedelta` object. (3)"
msgstr "余数为一个 :class:`timedelta` 对象。(3)"
#: ../../library/datetime.rst:359
msgid "``q, r = divmod(t1, t2)``"
msgstr "``q, r = divmod(t1, t2)``"
#: ../../library/datetime.rst:359
msgid ""
"Computes the quotient and the remainder: ``q = t1 // t2`` (3) and ``r = t1 %"
" t2``. ``q`` is an integer and ``r`` is a :class:`timedelta` object."
msgstr ""
"计算商和余数: ``q = t1 // t2`` (3) 和 ``r = t1 % t2``。 ``q`` 是一个整数而 ``r`` 是一个 "
":class:`timedelta` 对象。"
#: ../../library/datetime.rst:364
msgid "``+t1``"
msgstr "``+t1``"
#: ../../library/datetime.rst:364
msgid "Returns a :class:`timedelta` object with the same value. (2)"
msgstr "返回一个相同数值的 :class:`timedelta` 对象。"
#: ../../library/datetime.rst:367
msgid "``-t1``"
msgstr "``-t1``"
#: ../../library/datetime.rst:367
msgid ""
"Equivalent to ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``, and to"
" ``t1 * -1``. (1)(4)"
msgstr ""
"等价于 ``timedelta(-t1.days, -t1.seconds, -t1.microseconds)``,以及 ``t1 * -1``。 "
"(1)(4)"
#: ../../library/datetime.rst:371
msgid "``abs(t)``"
msgstr "``abs(t)``"
#: ../../library/datetime.rst:371
msgid ""
"Equivalent to ``+t`` when ``t.days >= 0``, and to ``-t`` when ``t.days < "
"0``. (2)"
msgstr "当 ``t.days >= 0`` 时等于 ``+t``,而当 ``t.days < 0`` 时等于 ``-t``。 (2)"
#: ../../library/datetime.rst:374
msgid "``str(t)``"
msgstr "``str(t)``"
#: ../../library/datetime.rst:374
msgid ""
"Returns a string in the form ``[D day[s], ][H]H:MM:SS[.UUUUUU]``, where D is"
" negative for negative ``t``. (5)"
msgstr ""
"返回一个形如 ``[D day[s], ][H]H:MM:SS[.UUUUUU]`` 的字符串,当 ``t`` 为负数的时候, D 也为负数。 (5)"
#: ../../library/datetime.rst:378
msgid "``repr(t)``"
msgstr "``repr(t)``"
#: ../../library/datetime.rst:378
msgid ""
"Returns a string representation of the :class:`timedelta` object as a "
"constructor call with canonical attribute values."
msgstr "返回一个 :class:`timedelta` 对象的字符串表示形式,作为附带正规属性值的构造器调用。"
#: ../../library/datetime.rst:384 ../../library/datetime.rst:623
#: ../../library/datetime.rst:2570
msgid "Notes:"
msgstr "注释:"
#: ../../library/datetime.rst:387
msgid "This is exact but may overflow."
msgstr "结果正确,但可能会溢出。"
#: ../../library/datetime.rst:390
msgid "This is exact and cannot overflow."
msgstr "结果正确,不会溢出。"
#: ../../library/datetime.rst:393
msgid "Division by zero raises :exc:`ZeroDivisionError`."
msgstr "除以零将会引发 :exc:`ZeroDivisionError`。"
#: ../../library/datetime.rst:396
msgid ""
"``-timedelta.max`` is not representable as a :class:`timedelta` object."
msgstr "``-timedelta.max`` 不可以表示为一个 :class:`timedelta` 对象。"
#: ../../library/datetime.rst:399
msgid ""
"String representations of :class:`timedelta` objects are normalized "
"similarly to their internal representation. This leads to somewhat unusual "
"results for negative timedeltas. For example::"
msgstr ":class:`timedelta` 对象的字符串表示形式类似于其内部表示形式被规范化。对于负时间增量,这会导致一些不寻常的结果。例如::"
#: ../../library/datetime.rst:403
msgid ""
">>> timedelta(hours=-5)\n"
"datetime.timedelta(days=-1, seconds=68400)\n"
">>> print(_)\n"
"-1 day, 19:00:00"
msgstr ""
">>> timedelta(hours=-5)\n"
"datetime.timedelta(days=-1, seconds=68400)\n"
">>> print(_)\n"
"-1 day, 19:00:00"
#: ../../library/datetime.rst:409
msgid ""
"The expression ``t2 - t3`` will always be equal to the expression ``t2 + "
"(-t3)`` except when t3 is equal to ``timedelta.max``; in that case the "
"former will produce a result while the latter will overflow."
msgstr ""
"表达式 ``t2 - t3`` 通常与 ``t2 + (-t3)`` 是等价的,除非 t3 等于 ``timedelta.max``; "
"在这种情况下前者会返回结果,而后者则会溢出。"
#: ../../library/datetime.rst:413
msgid ""
"In addition to the operations listed above, :class:`timedelta` objects "
"support certain additions and subtractions with :class:`date` and "
":class:`.datetime` objects (see below)."
msgstr ""
"除了上面列举的操作以外,:class:`timedelta` 对象还支持与 :class:`date` 和 :class:`.datetime` "
"对象进行特定的相加和相减运算(见下文)。"
#: ../../library/datetime.rst:417
msgid ""
"Floor division and true division of a :class:`timedelta` object by another "
":class:`timedelta` object are now supported, as are remainder operations and"
" the :func:`divmod` function. True division and multiplication of a "
":class:`timedelta` object by a :class:`float` object are now supported."
msgstr ""
"现在已支持 :class:`timedelta` 对象与另一个 :class:`timedelta` 对象相整除或相除,包括求余运算和 "
":func:`divmod` 函数。 现在也支持 :class:`timedelta` 对象加上或乘以一个 :class:`float` 对象。"
#: ../../library/datetime.rst:423
msgid ":class:`timedelta` objects support equality and order comparisons."
msgstr ":class:`timedelta` 对象支持相等性和顺序比较。"
#: ../../library/datetime.rst:425
msgid ""
"In Boolean contexts, a :class:`timedelta` object is considered to be true if"
" and only if it isn't equal to ``timedelta(0)``."
msgstr "在布尔运算中,:class:`timedelta` 对象当且仅当其不等于 ``timedelta(0)`` 时则会被视为真值。"
#: ../../library/datetime.rst:428 ../../library/datetime.rst:649
#: ../../library/datetime.rst:1248 ../../library/datetime.rst:1847
msgid "Instance methods:"
msgstr "实例方法:"
#: ../../library/datetime.rst:432
msgid ""
"Return the total number of seconds contained in the duration. Equivalent to "
"``td / timedelta(seconds=1)``. For interval units other than seconds, use "
"the division form directly (e.g. ``td / timedelta(microseconds=1)``)."
msgstr ""
"返回期间占用了多少秒。等价于 ``td / timedelta(seconds=1)``。对于秒以外的间隔单位,直接使用除法形式 (例如 ``td /"
" timedelta(microseconds=1)``)。"
#: ../../library/datetime.rst:436
msgid ""
"Note that for very large time intervals (greater than 270 years on most "
"platforms) this method will lose microsecond accuracy."
msgstr "需要注意的是,时间间隔较大时,这个方法的结果中的微秒将会失真(大多数平台上大于270年视为一个较大的时间间隔)。"
#: ../../library/datetime.rst:442
msgid "Examples of usage: :class:`timedelta`"
msgstr ":class:`timedelta` 用法示例"
#: ../../library/datetime.rst:444
msgid "An additional example of normalization::"
msgstr "一个标准化的附加示例::"
#: ../../library/datetime.rst:446
msgid ""
">>> # Components of another_year add up to exactly 365 days\n"
">>> from datetime import timedelta\n"
">>> year = timedelta(days=365)\n"
">>> another_year = timedelta(weeks=40, days=84, hours=23,\n"
"... minutes=50, seconds=600)\n"
">>> year == another_year\n"
"True\n"
">>> year.total_seconds()\n"
"31536000.0"
msgstr ""
">>> # another_year 的部分增加恰好 365 天\n"
">>> from datetime import timedelta\n"
">>> year = timedelta(days=365)\n"
">>> another_year = timedelta(weeks=40, days=84, hours=23,\n"
"... minutes=50, seconds=600)\n"
">>> year == another_year\n"
"True\n"
">>> year.total_seconds()\n"
"31536000.0"
#: ../../library/datetime.rst:456
msgid "Examples of :class:`timedelta` arithmetic::"
msgstr ":class:`timedelta` 算术运算的示例::"
#: ../../library/datetime.rst:458
msgid ""
">>> from datetime import timedelta\n"
">>> year = timedelta(days=365)\n"
">>> ten_years = 10 * year\n"
">>> ten_years\n"
"datetime.timedelta(days=3650)\n"
">>> ten_years.days // 365\n"
"10\n"
">>> nine_years = ten_years - year\n"
">>> nine_years\n"
"datetime.timedelta(days=3285)\n"
">>> three_years = nine_years // 3\n"
">>> three_years, three_years.days // 365\n"
"(datetime.timedelta(days=1095), 3)"
msgstr ""
">>> from datetime import timedelta\n"
">>> year = timedelta(days=365)\n"
">>> ten_years = 10 * year\n"
">>> ten_years\n"
"datetime.timedelta(days=3650)\n"
">>> ten_years.days // 365\n"
"10\n"
">>> nine_years = ten_years - year\n"
">>> nine_years\n"
"datetime.timedelta(days=3285)\n"
">>> three_years = nine_years // 3\n"
">>> three_years, three_years.days // 365\n"
"(datetime.timedelta(days=1095), 3)"
#: ../../library/datetime.rst:475
msgid ":class:`date` Objects"
msgstr ":class:`date` 对象"
#: ../../library/datetime.rst:477
msgid ""
"A :class:`date` object represents a date (year, month and day) in an "
"idealized calendar, the current Gregorian calendar indefinitely extended in "
"both directions."
msgstr ":class:`date` 对象代表一个理想化历法中的日期(年、月和日),即当今的格列高利历向前后两个方向无限延伸。"
#: ../../library/datetime.rst:481
msgid ""
"January 1 of year 1 is called day number 1, January 2 of year 1 is called "
"day number 2, and so on. [#]_"
msgstr "公元 1 年 1 月 1日是第 1 日,公元 1 年 1 月 2 日是第 2 日,依此类推。 [#]_"
#: ../../library/datetime.rst:486
msgid ""
"All arguments are required. Arguments must be integers, in the following "
"ranges:"
msgstr "所有参数都是必要的。 参数必须是在下面范围内的整数:"
#: ../../library/datetime.rst:489
msgid "``MINYEAR <= year <= MAXYEAR``"
msgstr "``MINYEAR <= year <= MAXYEAR``"
#: ../../library/datetime.rst:490
msgid "``1 <= month <= 12``"
msgstr "``1 <= month <= 12``"
#: ../../library/datetime.rst:491
msgid "``1 <= day <= number of days in the given month and year``"
msgstr "``1 <= 日期 <= 给定年月对应的天数``"
#: ../../library/datetime.rst:493 ../../library/datetime.rst:864
msgid ""
"If an argument outside those ranges is given, :exc:`ValueError` is raised."
msgstr "如果参数不在这些范围内,则抛出 :exc:`ValueError` 异常。"
#: ../../library/datetime.rst:496 ../../library/datetime.rst:869
msgid "Other constructors, all class methods:"
msgstr "其它构造器,所有的类方法:"
#: ../../library/datetime.rst:500
msgid "Return the current local date."
msgstr "返回当前的本地日期。"
#: ../../library/datetime.rst:502
msgid "This is equivalent to ``date.fromtimestamp(time.time())``."
msgstr "这等价于 ``date.fromtimestamp(time.time())``。"
#: ../../library/datetime.rst:506
msgid ""
"Return the local date corresponding to the POSIX timestamp, such as is "
"returned by :func:`time.time`."
msgstr "返回对应于 POSIX 时间戳的当地时间,例如 :func:`time.time` 返回的就是时间戳。"
#: ../../library/datetime.rst:509
msgid ""
"This may raise :exc:`OverflowError`, if the timestamp is out of the range of"
" values supported by the platform C :c:func:`localtime` function, and "
":exc:`OSError` on :c:func:`localtime` failure. It's common for this to be "
"restricted to years from 1970 through 2038. Note that on non-POSIX systems "
"that include leap seconds in their notion of a timestamp, leap seconds are "
"ignored by :meth:`fromtimestamp`."
msgstr ""
"这可能引发 :exc:`OverflowError`,如果时间戳数值超出所在平台 C :c:func:`localtime` "
"函数的支持范围的话,并且会在 :c:func:`localtime` 出错时引发 :exc:`OSError`。 通常该数值会被限制在 1970 年至 "
"2038 年之间。 请注意在时间戳概念包含闰秒的非 POSIX 系统上,闰秒会被 :meth:`fromtimestamp` 所忽略。"
#: ../../library/datetime.rst:516
msgid ""
"Raise :exc:`OverflowError` instead of :exc:`ValueError` if the timestamp is "
"out of the range of values supported by the platform C :c:func:`localtime` "
"function. Raise :exc:`OSError` instead of :exc:`ValueError` on "
":c:func:`localtime` failure."
msgstr ""
"引发 :exc:`OverflowError` 而不是 :exc:`ValueError`,如果时间戳数值超出所在平台 C "
":c:func:`localtime` 函数的支持范围的话,并会在 :c:func:`localtime` 出错时引发 :exc:`OSError` "
"而不是 :exc:`ValueError`。"
#: ../../library/datetime.rst:525
msgid ""
"Return the date corresponding to the proleptic Gregorian ordinal, where "
"January 1 of year 1 has ordinal 1."
msgstr "返回对应于预期格列高利历序号的日期,其中公元 1 年 1 月 1 日的序号为 1。"
#: ../../library/datetime.rst:528
msgid ""
":exc:`ValueError` is raised unless ``1 <= ordinal <= date.max.toordinal()``."
" For any date ``d``, ``date.fromordinal(d.toordinal()) == d``."
msgstr ""
"除非 ``1 <= ordinal <= date.max.toordinal()`` 否则会引发 :exc:`ValueError`。 对于任意的日期"
" ``d``,均有 ``date.fromordinal(d.toordinal()) == d``。"
#: ../../library/datetime.rst:535
msgid ""
"Return a :class:`date` corresponding to a *date_string* given in any valid "
"ISO 8601 format, with the following exceptions:"
msgstr "返回一个对应于以任何有效 ISO 8601 格式给出的 *date_string* 的 :class:`date`,下列格式除外:"
#: ../../library/datetime.rst:538 ../../library/datetime.rst:1029
msgid ""
"Reduced precision dates are not currently supported (``YYYY-MM``, ``YYYY``)."
msgstr "目前不支持降低精度的日期 (``YYYY-MM``, ``YYYY``)。"
#: ../../library/datetime.rst:540 ../../library/datetime.rst:1031
msgid ""
"Extended date representations are not currently supported (``±YYYYYY-MM-"
"DD``)."
msgstr "目前不支持扩展日期表示形式 (``±YYYYYY-MM-DD``)。"
#: ../../library/datetime.rst:542 ../../library/datetime.rst:1033
msgid "Ordinal dates are not currently supported (``YYYY-OOO``)."
msgstr "目前不支持序数日期 (``YYYY-OOO``)。"
#: ../../library/datetime.rst:544 ../../library/datetime.rst:1035
#: ../../library/datetime.rst:1476
msgid "Examples::"
msgstr "示例::"
#: ../../library/datetime.rst:546
msgid ""
">>> from datetime import date\n"
">>> date.fromisoformat('2019-12-04')\n"
"datetime.date(2019, 12, 4)\n"
">>> date.fromisoformat('20191204')\n"
"datetime.date(2019, 12, 4)\n"
">>> date.fromisoformat('2021-W01-1')\n"