File: README

package info (click to toggle)
libtime-moment-perl 0.41-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,024 kB
  • ctags: 1,354
  • sloc: perl: 6,312; ansic: 2,936; makefile: 3
file content (1693 lines) | stat: -rw-r--r-- 61,225 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
NAME
    Time::Moment - Represents a date and time of day with an offset from UTC

SYNOPSIS
        $tm = Time::Moment->new(
            year       => 2012,
            month      => 12,
            day        => 24,
            hour       => 15,
            minute     => 30,
            second     => 45,
            nanosecond => 123456789,
            offset     => 0,
        );
        $tm = Time::Moment->now;
        $tm = Time::Moment->now_utc;
        $tm = Time::Moment->from_epoch($seconds);
        $tm = Time::Moment->from_object($object);
        $tm = Time::Moment->from_string($string);
        $tm = Time::Moment->from_rd($rd);
        $tm = Time::Moment->from_jd($jd);
        $tm = Time::Moment->from_mjd($mjd);
    
        $year         = $tm->year;                      # [1, 9999]
        $quarter      = $tm->quarter;                   # [1, 4]
        $month        = $tm->month;                     # [1, 12]
        $week         = $tm->week;                      # [1, 53]
    
        $day          = $tm->day_of_year;               # [1, 366]
        $day          = $tm->day_of_quarter;            # [1, 92]
        $day          = $tm->day_of_month;              # [1, 31]
        $day          = $tm->day_of_week;               # [1=Monday, 7=Sunday]
    
        $hour         = $tm->hour;                      # [0, 23]
        $minute       = $tm->minute;                    # [0, 59]
        $minute       = $tm->minute_of_day;             # [0, 1439]
        $second       = $tm->second;                    # [0, 59]
        $second       = $tm->second_of_day;             # [0, 86_399]
        $millisecond  = $tm->millisecond;               # [0, 999]
        $millisecond  = $tm->millisecond_of_day;        # [0, 86_399_999]
        $microsecond  = $tm->microsecond;               # [0, 999_999]
        $microsecond  = $tm->microsecond_of_day;        # [0, 86_399_999_999]
        $nanosecond   = $tm->nanosecond;                # [0, 999_999_999]
        $nanosecond   = $tm->nanosecond_of_day;         # [0, 86_399_999_999_999]
    
        $epoch        = $tm->epoch;
        $offset       = $tm->offset;                    # [-1080, 1080] (±18:00)
    
        $jd           = $tm->jd;                        # Julian Date
        $mjd          = $tm->mjd;                       # Modified Julian Date
        $rd           = $tm->rd;                        # Rata Die
    
        $tm2          = $tm1->with($adjuster);
        $tm2          = $tm1->with_year($year);
        $tm2          = $tm1->with_quarter($quarter);
        $tm2          = $tm1->with_month($month);
        $tm2          = $tm1->with_week($week);
        $tm2          = $tm1->with_day_of_year($day);
        $tm2          = $tm1->with_day_of_quarter($day);
        $tm2          = $tm1->with_day_of_month($day);
        $tm2          = $tm1->with_day_of_week($day);
        $tm2          = $tm1->with_hour($hour);
        $tm2          = $tm1->with_minute($minute);
        $tm2          = $tm1->with_minute_of_day($minute);
        $tm2          = $tm1->with_second($second);
        $tm2          = $tm1->with_second_of_day($second);
        $tm2          = $tm1->with_millisecond($millisecond);
        $tm2          = $tm1->with_millisecond_of_day($millisecond);
        $tm2          = $tm1->with_microsecond($microsecond);
        $tm2          = $tm1->with_microsecond_of_day($microsecond);
        $tm2          = $tm1->with_nanosecond($nanosecond);
        $tm2          = $tm1->with_nanosecond_of_day($nanosecond);
    
        $tm2          = $tm1->with_offset_same_instant($offset);
        $tm2          = $tm1->with_offset_same_local($offset);
    
        $tm2          = $tm1->with_precision($precision);
    
        $tm2          = $tm1->plus_years($years);
        $tm2          = $tm1->plus_months($months);
        $tm2          = $tm1->plus_weeks($weeks);
        $tm2          = $tm1->plus_days($days);
        $tm2          = $tm1->plus_hours($hours);
        $tm2          = $tm1->plus_minutes($minutes);
        $tm2          = $tm1->plus_seconds($seconds);
        $tm2          = $tm1->plus_milliseconds($milliseconds);
        $tm2          = $tm1->plus_microseconds($microseconds);
        $tm2          = $tm1->plus_nanoseconds($nanoseconds);
    
        $tm2          = $tm1->minus_years($years);
        $tm2          = $tm1->minus_months($months);
        $tm2          = $tm1->minus_weeks($weeks);
        $tm2          = $tm1->minus_days($days);
        $tm2          = $tm1->minus_hours($hours);
        $tm2          = $tm1->minus_minutes($minutes);
        $tm2          = $tm1->minus_seconds($seconds);
        $tm2          = $tm1->minus_milliseconds($milliseconds);
        $tm2          = $tm1->minus_microseconds($microseconds);
        $tm2          = $tm1->minus_nanoseconds($nanoseconds);
    
        $years        = $tm1->delta_years($tm2);
        $months       = $tm1->delta_months($tm2);
        $weeks        = $tm1->delta_weeks($tm2);
        $days         = $tm1->delta_days($tm2);
        $hours        = $tm1->delta_hours($tm2);
        $minutes      = $tm1->delta_minutes($tm2);
        $seconds      = $tm1->delta_seconds($tm2);
        $milliseconds = $tm1->delta_milliseconds($tm2);
        $microseconds = $tm1->delta_microseconds($tm2);
        $nanoseconds  = $tm1->delta_nanoseconds($tm2);
    
        $tm2          = $tm1->at_utc;
    
        $tm2          = $tm1->at_midnight;              # T00:00:00.0
        $tm2          = $tm1->at_noon;                  # T12:00:00.0
    
        $tm2          = $tm1->at_last_day_of_year;
        $tm2          = $tm1->at_last_day_of_quarter;
        $tm2          = $tm1->at_last_day_of_month;
    
        $boolean      = $tm1->is_before($tm2);
        $boolean      = $tm1->is_after($tm2);
        $boolean      = $tm1->is_equal($tm2);
    
        $integer      = $tm1->compare($tm2);
    
        $boolean      = $tm->is_leap_year;
    
        $string       = $tm->to_string;
        $string       = $tm->strftime($format);
    
        $integer      = $tm->length_of_year;            # [365, 366]
        $integer      = $tm->length_of_quarter;         # [90, 92]
        $integer      = $tm->length_of_month;           # [28, 31]
        $integer      = $tm->length_of_week_year;       # [52, 53]
    
        @values       = $tm->utc_rd_values;
        $seconds      = $tm->utc_rd_as_seconds;
        @values       = $tm->local_rd_values;
        $seconds      = $tm->local_rd_as_seconds;
    
        $integer      = $tm1 <=> $tm2;
    
        $boolean      = $tm1 == $tm2;
        $boolean      = $tm1 != $tm2;
        $boolean      = $tm1 <  $tm2;
        $boolean      = $tm1 >  $tm2;
        $boolean      = $tm1 <= $tm2;
        $boolean      = $tm1 >= $tm2;
    
        $string       = "$tm";

DESCRIPTION
    "Time::Moment" is an immutable object representing a date and time of
    day with an offset from UTC in the ISO 8601 calendar system.

    Time is measured in nanoseconds since "0001-01-01T00Z". In "Time:Moment"
    leap seconds are ignored. It is assumed that there are exactly
    "86,400,000,000,000" nanoseconds per day. "Time::Moment" can represent
    all epoch integers from "-62,135,596,800" to "2,534,02,300,799"; this
    range suffices to measure times to nanosecond precision for any instant
    that is within "0001-01-01T00:00:00Z" to "9999-12-31T23:59:59Z".

CONSTRUCTORS
  new
        $tm = Time::Moment->new(
            year       => 2012,
            month      => 12,
            day        => 24,
            hour       => 15,
            minute     => 30,
            second     => 45,
            nanosecond => 123456789,
            offset     => 0,
        );

    Constructs an instance of "Time::Moment" from the given components.

    Parameters:

    year
        The year [1, 9999].

    month
        The month of the year [1, 12].

    day The day of the month [1, 31]. The day must be valid for the year and
        month, otherwise an exception is raised.

    hour
        The hour of the day [0, 23].

    minute
        The minute of the hour [0, 59].

    second
        The second of the minute [0, 59].

    nanosecond
        The nanosecond of the second [0, 999_999_999].

    offset
        The offset from UTC in minutes [-1080, 1080] (±18:00).

  now
        $tm = Time::Moment->now;

    Constructs an instance of "Time::Moment" that is set to the current date
    and time from the system clock in the system time zone, with the offset
    set to the system's time zone offset from UTC.

  now_utc
        $tm = Time::Moment->now_utc;

    Constructs an instance of "Time::Moment" that is set to the current date
    and time from the system clock in the UTC time zone.

  from_epoch
        $tm = Time::Moment->from_epoch($seconds);
        $tm = Time::Moment->from_epoch($seconds, $nanosecond);
        $tm = Time::Moment->from_epoch($seconds [, nanosecond => 0] [, precision => 6]);

    Constructs an instance of "Time::Moment" from the given *seconds* from
    the epoch of 1970-01-01T00Z. Fractional seconds is supported if the
    constructor is invoked with *seconds* only, the default precision is 6
    (microseconds).

    Parameters:

    nanosecond
            $tm = Time::Moment->from_epoch($seconds, nanosecond => 0);

        The optional parameter *nanosecond* [0, 999_999_999] specifies the
        nanosecond of the second.

    precision
            $tm = Time::Moment->from_epoch($seconds, precision => 6);

        The optional parameter *precision* [0, 9] specifies the precision of
        the fractional seconds. The default precision is 6 (microseconds).

  from_object
        $tm = Time::Moment->from_object($object);

    Constructs an instance of "Time::Moment" from the given *object*. If the
    given object is an instance of "Time::Moment" it's returned otherwise an
    attempt is made to coerce the given object to an instance of
    "Time::Moment".

    "Time::Moment" implements coercion handlers for the following object
    types:

    DateTime
            $tm = Time::Moment->from_object( DateTime->now );

        The given "DateTime" object must be within the supported range and
        must have a time zone or an offset from UTC, coercing from the
        'floating' time zone is not supported.

    Time::Piece
            $tm = Time::Moment->from_object( scalar Time::Piece::localtime() );

        The given "Time::Piece" object must be within the supported date
        range.

    The coercion scheme is extensible and implemented as documented in
    Params::Coerce:

        $tm = Params::Coerce::coerce('Time::Moment', scalar Time::Piece::localtime());
        $tm = Params::Coerce::coerce('Time::Moment', DateTime->now);

    "Time::Moment" also implements a coercion handler from "Time::Moment" to
    "DateTime" and "Time::Piece":

        $dt = Params::Coerce::coerce('DateTime', Time::Moment->now);
        $tp = Params::Coerce::coerce('Time::Piece', Time::Moment->now);

  from_string
        $tm = Time::Moment->from_string($string);
        $tm = Time::Moment->from_string($string [, lenient => false]);

    Constructs an instance of "Time::Moment" from the given *string*. The
    string must consist of a complete date representation and time of day
    followed by a zone designator. The time of day may be reduced to hour of
    the day, the second of the minute may have a decimal fraction. The
    decimal sign can be either the comma [,] or the full stop [.]. A decimal
    fraction must have at least one digit and may have a total of nine
    digits, if the fractional precision is greater than nine digits, the
    value will be truncated.

    The following are examples of complete date and time of day
    representations:

        Basic format:                 Example:
        YYYYMMDDThhmmssZ              20121224T121530Z
        YYYYMMDDThhmmss±hhmm          20121224T121530+0100
        YYYYMMDDThhmmss±hh            20121224T121530+01
    
        YYYYMMDDThhmmss.ssZ           20121224T121530.500Z
        YYYYMMDDThhmmss.ss±hhmm       20121224T121530.500+0100
        YYYYMMDDThhmmss.ss±hh         20121224T121530.500+01
    
        YYYYMMDDThhZ                  20121224T12Z              (reduced accuracy)
        YYYYMMDDThhmmZ                20121224T1215Z            (reduced accuracy)
        YYYYMMDDThhmm±hhmm            20121224T1215+0100        (reduced accuracy)
        YYYYMMDDThhmm±hh              20121224T1215+01          (reduced accuracy)
    
        Extended format:              Example:
        YYYY-MM-DDThh:mm:ssZ          2012-12-24T12:15:30Z
        YYYY-MM-DDThh:mm:ss±hh:mm     2012-12-24T12:15:30+01:00
        YYYY-MM-DDThh:mm:ss±hh        2012-12-24T12:15:30+01
    
        YYYY-MM-DDThh:mm:ss.ssZ       2012-12-24T12:15:30.500Z
        YYYY-MM-DDThh:mm:ss.ss±hh:mm  2012-12-24T12:15:30.500+01:00
        YYYY-MM-DDThh:mm:ss.ss±hh     2012-12-24T12:15:30.500+01
    
        YYYY-MM-DDThhZ                2012-12-24T12Z            (reduced accuracy)
        YYYY-MM-DDThh:mmZ             2012-12-24T12:15Z         (reduced accuracy)
        YYYY-MM-DDThh:mm±hh:mm        2012-12-24T12:15+01:00    (reduced accuracy)
        YYYY-MM-DDThh:mm±hh           2012-12-24T12:15+01       (reduced accuracy)

    Where representations using calendar dates are shown, ordinal dates or
    week dates may be substituted. This ISO 8601 profile correspond to a
    subset of ISO 8601:2004 4.3 Date and time of day.

    If the optional boolean parameter *lenient* is true, the following
    examples are also accepted:

        YYYY-MM-DD hh:mm:ssZ          2012-12-24 12:15:30Z
        YYYY-MM-DD hh:mm:ssz          2012-12-24 12:15:30z
        YYYY-MM-DD hh:mm:ss±hhmm      2012-12-24 12:15:30+0100
        YYYY-MM-DD hh:mm:ss±hh:mm     2012-12-24 12:15:30+01:00
        YYYY-MM-DD hh:mm:ss±hh        2012-12-24 12:15:30+01
    
        YYYY-MM-DD hh:mm:ss.ssZ       2012-12-24 12:15:30.500Z
        YYYY-MM-DD hh:mm:ss.ssz       2012-12-24 12:15:30.500z
        YYYY-MM-DD hh:mm:ss.ss±hhmm   2012-12-24 12:15:30.500+0100
        YYYY-MM-DD hh:mm:ss.ss±hh:mm  2012-12-24 12:15:30.500+01:00
        YYYY-MM-DD hh:mm:ss.ss±hh     2012-12-24 12:15:30.500+01
    
        YYYY-MM-DD hh:mmZ             2012-12-24 12:15Z
        YYYY-MM-DD hh:mmz             2012-12-24 12:15z
        YYYY-MM-DD hh:mm±hhmm         2012-12-24 12:15+0100
        YYYY-MM-DD hh:mm±hh:mm        2012-12-24 12:15+01:00
        YYYY-MM-DD hh:mm±hh           2012-12-24 12:15+01
    
        YYYY-MM-DD hh:mm:ss ±hh:mm    2012-12-24 12:15:30 +01:00
        YYYY-MM-DD hh:mm:ss ±hhmm     2012-12-24 12:15:30 +0100
        YYYY-MM-DD hh:mm:ss ±hh       2012-12-24 12:15:30 +01
        YYYY-MM-DD hh:mm:ss GMT       2012-12-24 12:15:30 GMT
        YYYY-MM-DD hh:mm:ss GMT±hh    2012-12-24 12:15:30 GMT+01
        YYYY-MM-DD hh:mm:ss UTC       2012-12-24 12:15:30 UTC
        YYYY-MM-DD hh:mm:ss UTC±hh    2012-12-24 12:15:30 UTC+01
    
        YYYY-MM-DD hh:mm:ss.ss ±hhmm  2012-12-24 12:15:30.500 +0100
        YYYY-MM-DD hh:mm:ss.ss ±hh:mm 2012-12-24 12:15:30.500 +01:00
        YYYY-MM-DD hh:mm:ss.ss ±hh    2012-12-24 12:15:30.500 +01
    
        YYYY-MM-DD hh:mm ±hh:mm       2012-12-24 12:15 +01:00
        YYYY-MM-DD hh:mm ±hhmm        2012-12-24 12:15 +0100
        YYYY-MM-DD hh:mm ±hh          2012-12-24 12:15 +01

    The string representation may consist of a mixture of the basic format
    and the extended format. The time designator [T] may be in lower case
    [t] or replaced with a single space. A single space is also accepted
    between the time of day and the zone designator. The UTC designator [Z]
    may also be in lower case [z]. The literal string GMT or UTC may be used
    as a UTC designator and may have an offset. Usage of these string
    representations is strongly discouraged as they do not conform to the
    ISO 8601 standard.

  from_rd
        $tm = Time::Moment->from_rd($rd);
        $tm = Time::Moment->from_rd($rd [, offset => 0] [, precision => 3] [, epoch => 0]);

    Constructs an instance of "Time::Moment" from the given Rata Die. The
    Rata Die is a count of days elapsed since 0000-12-31T00. The fractional
    part corresponds to the fraction of the day after midnight. The minimum
    acceptable Rata Die is 1 which corresponds to 0001-01-01T00.

    Parameters:

    offset
            $tm = Time::Moment->from_rd($rd, offset => 0);

        The optional parameter *offset* [-1080, 1080] (±18:00) specifies the
        offset from UTC in minutes. The default offset is 0.

    precision
            $tm = Time::Moment->from_rd($rd, precision => 3);

        The optional parameter *precision* [0, 9] specifies the precision of
        the fractional seconds. The default precision is 3 (milliseconds).

    epoch
            $tm = Time::Moment->from_rd($rd, epoch => 0);

        The optional parameter *epoch* specifies the epoch date relative to
        0000-12-31T00. The epoch date for the Rata Die is 0.

  from_jd
        $tm = Time::Moment->from_jd($jd);
        $tm = Time::Moment->from_jd($jd [, precision => 3] [, epoch => -1721424.5]);

    Constructs an instance of "Time::Moment" from the given Julian Date. The
    Julian Date is a count of days elapsed since -4713-11-24T12Z. The
    fractional part corresponds to the fraction of the day after noon. The
    minimum acceptable Julian Date is 1721425.5 which corresponds to
    0001-01-01T00Z.

    Parameters:

    precision
            $tm = Time::Moment->from_jd($jd, precision => 3);

        The optional parameter *precision* [0, 9] specifies the precision of
        the fractional seconds. The default precision is 3 (milliseconds).

    epoch
            $tm = Time::Moment->from_jd($jd, epoch => -1721424.5);

        The optional parameter *epoch* specifies the epoch date relative to
        0000-12-31T00Z. The epoch date for the Julian Date is -1721424.5.

  from_mjd
        $tm = Time::Moment->from_mjd($mjd);
        $tm = Time::Moment->from_mjd($mjd [, precision => 3] [, epoch => 678576]);

    Constructs an instance of "Time::Moment" from the given Modified Julian
    Date. The Modified Julian Date is a count of days elapsed since
    1858-11-17T00Z. The fractional part corresponds to the fraction of the
    day after midnight. The minimum acceptable Modified Julian Date is
    -678575 which corresponds to 0001-01-01T00Z.

    Parameters:

    precision
            $tm = Time::Moment->from_mjd($mjd, precision => 3);

        The optional parameter *precision* [0, 9] specifies the precision of
        the fractional seconds. The default precision is 3 (milliseconds).

    epoch
            $tm = Time::Moment->from_mjd($mjd, epoch => 678576);

        The optional parameter *epoch* specifies the epoch date relative to
        0000-12-31T00Z. The epoch date for the Modified Julian Date is
        678576.

INSTANCE METHODS
  year
        $year = $tm->year;

    Returns the year [1, 9999].

  quarter
        $quarter = $tm->quarter;

    Returns the quarter of the year [1, 4].

  month
        $month = $tm->month;

    Returns the month of the year [1, 12].

  week
        $week = $tm->week;

    Returns the week of the year [1, 53].

  day_of_year
        $day = $tm->day_of_year;

    Returns the day of the year [1, 366].

  day_of_quarter
        $day = $tm->day_of_quarter;

    Returns the day of the quarter [1, 92].

  day_of_month
        $day = $tm->day_of_month;

    Returns the day of the month [1, 31].

  day_of_week
        $day = $tm->day_of_week;

    Returns the day of the week [1=Monday, 7=Sunday].

  hour
        $hour = $tm->hour;

    Returns the hour of the day [0, 23].

  minute
        $minute = $tm->minute;

    Returns the minute of the hour [0, 59].

  minute_of_day
        $minute = $tm->minute_of_day;

    Returns the minute of the day [0, 1439].

  second
        $second = $tm->second;

    Returns the second of the minute [0, 59].

  second_of_day
        $second = $tm->second_of_day;

    Returns the second of the day [0, 86_399].

  millisecond
        $millisecond = $tm->millisecond;

    Returns the millisecond of the second [0, 999].

  millisecond_of_day
        $millisecond = $tm->millisecond_of_day;

    Returns the millisecond of the day [0, 86_399_999].

  microsecond
        $microsecond = $tm->microsecond;

    Returns the microsecond of the second [0, 999_999].

  microsecond_of_day
        $microsecond = $tm->microsecond_of_day;

    Returns the microsecond of the day [0, 86_399_999_999].

  nanosecond
        $nanosecond = $tm->nanosecond;

    Returns the nanosecond of the second [0, 999_999_999].

  nanosecond_of_day
        $nanosecond = $tm->nanosecond_of_day;

    Returns the nanosecond of the day [0, 86_399_999_999_999].

  epoch
        $epoch = $tm->epoch;

    Returns the number of integral seconds from the epoch of 1970-01-01T00Z.

  offset
        $offset = $tm->offset;

    Returns the offset from UTC in minutes [-1080, 1080] (±18:00).

  precision
        $precision = $tm->precision;

    Returns the precision of the time of the day [-3, 9]. Please see
    with_precision for an explanation of the returned precision value.

  jd
        $jd = $tm->jd;
        $jd = $tm->jd([precision => 3]);

    Returns the Julian Date. The Julian Date is a count of days elapsed
    since -4713-11-24T12Z. The fractional part corresponds to the fraction
    of the day after noon. The optional named parameter *precision* [0, 9]
    specifies the precision of the fractional seconds. The default precision
    is 3 (milliseconds).

  mjd
        $mjd = $tm->mjd;
        $mjd = $tm->mjd([precision => 3]);

    Returns the Modified Julian Date. The Modified Julian Date is a count of
    days elapsed since 1858-11-17T00Z. The fractional part corresponds to
    the fraction of the day after midnight. The optional named parameter
    *precision* [0, 9] specifies the precision of the fractional seconds.
    The default precision is 3 (milliseconds).

  rd
        $rd = $tm->rd;
        $rd = $tm->rd([precision => 3]);

    Returns the Rata Die. The Rata Die is a count of days elapsed since
    0000-12-31T00. The fractional part corresponds to the fraction of the
    day after midnight. The optional named parameter *precision* [0, 9]
    specifies the precision of the fractional seconds. The default precision
    is 3 (milliseconds).

  with
        $tm2 = $tm1->with($adjuster);

    Returns a copy of this instance adjusted by the given *adjuster*. The
    adjuster is a CODE reference invoked with an instance of Time::Moment
    and is expected to return an instance of Time::Moment. Please see
    Time::Moment::Adjusters for available adjusters.

  with_year
        $tm2 = $tm1->with_year($year);

    Returns a copy of this instance with the given *year* [1, 9999] altered.
    The day of the month of the date is unchanged unless the day does not
    exist in the month. In that case, the day is set to the last day of the
    month.

  with_quarter
        $tm2 = $tm1->with_quarter($quarter);

    Returns a copy of this instance with the given *quarter* of the year [1,
    4] altered. The day of the month of the date is unchanged unless the day
    does not exist in the month of the quarter. In that case, the day is set
    to the last day of the month.

  with_month
        $tm2 = $tm1->with_month($month);

    Returns a copy of this instance with the given *month* of the year [1,
    12] altered. The day of the month of the date is unchanged unless the
    day does not exist in the given month. In that case, the day is set to
    the last day of the given month.

  with_week
        $tm2 = $tm1->with_week($week);

    Returns a copy of this instance with the given *week* of the year [1,
    53] altered. The week must be valid for the year, otherwise an exception
    is raised.

  with_day_of_year
        $tm2 = $tm1->with_day_of_year($day);

    Returns a copy of this instance with the given *day* of the year [1,
    366] altered. The day must be valid for the year, otherwise an exception
    is raised.

  with_day_of_quarter
        $tm2 = $tm1->with_day_of_quarter($day);

    Returns a copy of this instance with the given *day* of the quarter [1,
    92] altered. The day must be valid for the year and quarter, otherwise
    an exception is raised.

  with_day_of_month
        $tm2 = $tm1->with_day_of_month($day);

    Returns a copy of this instance with the given *day* of the month [1,
    31] altered. The day must be valid for the year and month, otherwise an
    exception is raised.

  with_day_of_week
        $tm2 = $tm1->with_day_of_week($day);

    Returns a copy of this instance with the given *day* of the week
    [1=Monday, 7=Sunday] altered.

  with_hour
        $tm2 = $tm1->with_hour($hour);

    Returns a copy of this instance with the given *hour* of the day [0, 23]
    altered.

  with_minute
        $tm2 = $tm1->with_minute($minute);

    Returns a copy of this instance with the given *minute* of the hour [0,
    59] altered.

  with_minute_of_day
        $tm2 = $tm1->with_minute_of_day($minute);

    Returns a copy of this instance with the given *minute* of the day [0,
    1439] altered, any lower-order time elements is unaltered.

  with_second
        $tm2 = $tm1->with_second($second);

    Returns a copy of this instance with the given *second* of the minute
    [0, 59] altered.

  with_second_of_day
        $tm2 = $tm1->with_second_of_day($second);

    Returns a copy of this instance with the given *second* of the day [0,
    86_399] altered, any lower-order time elements is unaltered.

  with_millisecond
        $tm2 = $tm1->with_millisecond($millisecond);

    Returns a copy of this instance with the given *millisecond* of the
    second [0, 999] altered. The nanosecond of the second is replaced with
    the given *millisecond* multiplied by 1,000,000.

  with_millisecond_of_day
        $tm2 = $tm1->with_millisecond_of_day($millisecond);

    Returns a copy of this instance with the given *millisecond* of the day
    [0, 86_400_000] altered. A millisecond value of 86_400_000 (T24:00) is
    normalized to midnight of the following day, any lower-order time
    elements is truncated.

  with_microsecond
        $tm2 = $tm1->with_microsecond($microsecond);

    Returns a copy of this instance with the given *microsecond* of the
    second [0, 999_999] altered. The nanosecond of the second is replaced
    with the given *microsecond* multiplied by 1,000.

  with_microsecond_of_day
        $tm2 = $tm1->with_microsecond_of_day($microsecond);

    Returns a copy of this instance with the given *microsecond* of the day
    [0, 86_400_000_000] altered. A microsecond value of 86_400_000_000
    (T24:00) is normalized to midnight of the following day, any lower-order
    time elements is truncated.

  with_nanosecond
        $tm2 = $tm1->with_nanosecond($nanosecond);

    Returns a copy of this instance with the given *nanosecond* of the
    second [0, 999_999_999] altered.

  with_nanosecond_of_day
        $tm2 = $tm1->with_nanosecond_of_day($nanosecond);

    Returns a copy of this instance with the given *nanosecond* of the day
    [0, 86_400_000_000_000] altered. A nanosecond value of
    86_400_000_000_000 (T24:00) is normalized to midnight of the following
    day.

  with_offset_same_instant
        $tm2 = $tm1->with_offset_same_instant($offset);

    Returns a copy of this instance with the given *offset* from UTC in
    minutes [-1080, 1080] (±18:00) altered. The resulting time is at the
    same instant.

        $tm = Time::Moment->from_string('2012-12-24T15-05')
                          ->with_offset_same_instant(0);
        say $tm; # 2012-12-24T20Z

  with_offset_same_local
        $tm2 = $tm1->with_offset_same_local($offset);

    Returns a copy of this instance with the given *offset* from UTC in
    minutes [-1080, 1080] (±18:00) altered. The resulting time has the same
    local time.

        $tm = Time::Moment->from_string('2012-12-24T15-05')
                          ->with_offset_same_local(0);
        say $tm; # 2012-12-24T15Z

  with_precision
        $tm2 = $tm1->with_precision($precision);

    Returns a copy of this instance with the time of the day altered to the
    given *precision* [-3, 9]. A precision value between [0, 9] alters the
    precision of the fractional seconds. A precision of -1 truncates to
    minute of the hour; -2 truncates to hour of the day; -3 truncates to
    midnight of the day.

        $tm = Time::Moment->from_string('2012-12-24T12:30:45.123456789Z');
        say $tm->with_precision(6);  # T12:30:45.123456Z
        say $tm->with_precision(3);  # T12:30:45.123Z
        say $tm->with_precision(0);  # T12:30:45Z
        say $tm->with_precision(-1); # T12:30:00Z
        say $tm->with_precision(-2); # T12:00:00Z
        say $tm->with_precision(-3); # T00:00:00Z

  plus_years
        $tm2 = $tm1->plus_years($years);

    Returns a copy of this instance with the given number of *years* added.
    The day of the month of the date is unchanged unless the day does not
    exist in the resulting month. In that case, the day is set to the last
    day of the resulting month. For example, 2012-02-29 plus one year
    results in 2013-02-28.

  plus_months
        $tm2 = $tm1->plus_months($months);

    Returns a copy of this instance with the given number of *months* added.
    The day of the month of the date is unchanged unless the day does not
    exist in the resulting month. In that case, the day is set to the last
    day of the resulting month. For example, 2013-01-31 plus one month
    results in 2013-02-28; 2013-02-28 plus one month results in 2013-03-28.

  plus_weeks
        $tm2 = $tm1->plus_weeks($weeks);

    Returns a copy of this instance with the given number of *weeks* added.

  plus_days
        $tm2 = $tm1->plus_days($days);

    Returns a copy of this instance with the given number of *days* added.

  plus_hours
        $tm2 = $tm1->plus_hours($hours);

    Returns a copy of this instance with the given number of *hours* added.

  plus_minutes
        $tm2 = $tm1->plus_minutes($minutes);

    Returns a copy of this instance with the given number of *minutes*
    added.

  plus_seconds
        $tm2 = $tm1->plus_seconds($seconds);

    Returns a copy of this instance with the given number of *seconds*
    added.

  plus_milliseconds
        $tm2 = $tm1->plus_milliseconds($milliseconds);

    Returns a copy of this instance with the given number of *milliseconds*
    added.

  plus_microseconds
        $tm2 = $tm1->plus_microseconds($microseconds);

    Returns a copy of this instance with the given number of *microseconds*
    added.

  plus_nanoseconds
        $tm2 = $tm1->plus_nanoseconds($nanoeconds);

    Returns a copy of this instance with the given number of *nanoseconds*
    added.

  minus_years
        $tm2 = $tm1->minus_years($years);

    Returns a copy of this instance with the given number of *years*
    subtracted. The day of the month of the date is unchanged unless the day
    does not exist in the resulting month. In that case, the day is set to
    the last day of the resulting month. For example, 2012-02-29 minus one
    year results in 2011-02-28.

  minus_months
        $tm2 = $tm1->minus_months($months);

    Returns a copy of this instance with the given number of *months*
    subtracted. The day of the month of the date is unchanged unless the day
    does not exist in the resulting month. In that case, the day is set to
    the last day of the resulting month. For example, 2013-03-31 minus one
    month results in 2013-02-28; 2013-02-28 minus one month results in
    2013-01-28.

  minus_weeks
        $tm2 = $tm1->minus_weeks($weeks);

    Returns a copy of this instance with the given number of *weeks*
    subtracted.

  minus_days
        $tm2 = $tm1->minus_days($days);

    Returns a copy of this instance with the given number of *days*
    subtracted.

  minus_hours
        $tm2 = $tm1->minus_hours($hours);

    Returns a copy of this instance with the given number of *hours*
    subtracted.

  minus_minutes
        $tm2 = $tm1->minus_minutes($minutes);

    Returns a copy of this instance with the given number of *minutes*
    subtracted.

  minus_seconds
        $tm2 = $tm1->minus_seconds($seconds);

    Returns a copy of this instance with the given number of *seconds*
    subtracted.

  minus_milliseconds
        $tm2 = $tm1->minus_milliseconds($milliseconds);

    Returns a copy of this instance with the given number of *milliseconds*
    subtracted.

  minus_microseconds
        $tm2 = $tm1->minus_microseconds($microseconds);

    Returns a copy of this instance with the given number of *microseconds*
    subtracted.

  minus_nanoseconds
        $tm2 = $tm1->minus_nanoseconds($nanoseconds);

    Returns a copy of this instance with the given number of *nanoseconds*
    subtracted.

  delta_years
        $years = $tm->delta_years($other);

    Returns the difference between the local date of this moment and the
    *other* in terms of complete years. The result will be negative if the
    local date of the *other* moment is before this.

  delta_months
        $months = $tm->delta_months($other);

    Returns the difference between the local date of this moment and the
    *other* in terms of complete months. The result will be negative if the
    local date of the *other* moment is before this.

  delta_weeks
        $weeks = $tm->delta_weeks($other);

    Returns the difference between the local date of this moment and the
    *other* in terms of complete weeks. The result will be negative if the
    local date of the *other* moment is before this.

  delta_days
        $days = $tm->delta_days($other);

    Returns the difference between the local date of this moment and the
    *other* in terms of complete days. The result will be negative if the
    local date of the *other* moment is before this.

  delta_hours
        $hours = $tm->delta_hours($other);

    Returns the difference between the instant of this moment and the
    *other* in terms of complete hours. The result will be negative if the
    instant of the *other* moment is before this.

  delta_minutes
        $minutes = $tm->delta_minutes($other);

    Returns the difference between the instant of this moment and the
    *other* in terms of complete minutes. The result will be negative if the
    instant of the *other* moment is before this.

  delta_seconds
        $seconds = $tm->delta_seconds($other);

    Returns the difference between the instant of this moment and the
    *other* in terms of complete seconds. The result will be negative if the
    instant of the *other* moment is before this.

  delta_milliseconds
        $milliseconds = $tm->delta_milliseconds($other);

    Returns the difference between the instant of this moment and the
    *other* in terms of complete milliseconds. The result will be negative
    if the instant of the *other* moment is before this.

  delta_microseconds
        $microseconds = $tm->delta_microseconds($other);

    Returns the difference between the instant of this moment and the
    *other* in terms of complete microseconds. The result will be negative
    if the instant of the *other* moment is before this.

  delta_nanoseconds
        $nanoseconds = $tm->delta_nanoseconds($other);

    Returns the difference between the instant of this moment and the
    *other* in terms of complete nanoseconds. The result will be negative if
    the instant of the *other* moment is before this.

  at_utc
        $tm2 = $tm1->at_utc;

    Returns a copy of this instance with the offset from UTC set to zero.
    This method is equivalent to:

        $tm2 = $tm1->with_offset_same_instant(0);

  at_midnight
        $tm2 = $tm1->at_midnight;

    Returns a copy of this instance with the time of day set to midnight,
    T00:00:00.0. This method is equivalent to:

        $tm2 = $tm1->with_hour(0)
                   ->with_minute(0)
                   ->with_second(0)
                   ->with_nanosecond(0);

  at_noon
        $tm2 = $tm1->at_noon;

    Returns a copy of this instance with the time of day set to noon,
    T12:00:00.0. This method is equivalent to:

        $tm2 = $tm1->with_hour(12)
                   ->with_minute(0)
                   ->with_second(0)
                   ->with_nanosecond(0);

  at_last_day_of_year
        $tm2 = $tm1->at_last_day_of_year;

    Returns a copy of this instance with the date adjusted to the last day
    of the year, the time of the day is unaltered.

  at_last_day_of_quarter
        $tm2 = $tm1->at_last_day_of_quarter;

    Returns a copy of this instance with the date adjusted to the last day
    of the quarter, the time of the day is unaltered.

  at_last_day_of_month
        $tm2 = $tm1->at_last_day_of_month;

    Returns a copy of this instance with the date adjusted to the last day
    of the month, the time of the day is unaltered.

  is_before
        $boolean = $tm->is_before($other);

    Returns a boolean indicating whether or not the instant of this time is
    before the *other* time.

  is_after
        $boolean = $tm->is_after($other);

    Returns a boolean indicating whether or not the instant of this time is
    after the *other* time.

  is_equal
        $boolean = $tm->is_equal($other);

    Returns a boolean indicating whether or not the instant of this time is
    equal the *other* time.

  compare
        $integer = $tm->compare($other);
        $integer = $tm->compare($other [, precision => 9]);

    Returns an integer indicating whether the instant of this time is
    before, after or equal the *other* time. Returns a value less than zero
    if this time is before the other; zero if this date is equal the other
    time; a value greater than zero if this time is after the other time.
    The optional parameter *precision* [-3, 9] specifies the precision of
    the comparison. The default precision is 9 (nanoseconds). Please see
    with_precision for an explanation of the precision value.

  is_leap_year
        $boolean = $tm->is_leap_year;

    Returns a boolean indicating whether or not the year of the local date
    of this moment is a leap year.

  to_string
        $string = $tm->to_string;
        $string = $tm->to_string([reduced => false]);

    Returns a string representation of the instance. If the optional named
    boolean parameter *reduced* is true a shorter representation is
    attempted.

    The string will be in one of the following representations:

        YYYY-MM-DDThh:mm                (only if reduced => true)
        YYYY-MM-DDThh:mm:ss
        YYYY-MM-DDThh:mm:ss.fff
        YYYY-MM-DDThh:mm:ss.ffffff
        YYYY-MM-DDThh:mm:ss.fffffffff

    Followed by a zone designator in one of the following representations:

        Z
        ±hh                             (only if reduced => true)
        ±hh:mm

    The shortest representation will be used where the omitted parts are
    implied to be zero.

  strftime
        $string = $tm->strftime($format);

    Formats time according to the conversion specifications in the given
    $format string. The format string consists of zero or more conversion
    specifications and ordinary characters. All ordinary characters are
    copied directly into the resulting string. A conversion specification
    consists of a percent sign "%" and one other character.

    The following conversion specifications are supported:

    %a  Replaced by the C locale's abbreviated day of the week name.
        Example: Mon, Tue, ..., Sun.

    %A  Replaced by the C locale's full day of the week name. Example:
        Monday, Tuesday, ..., Sunday.

    %b  Replaced by the C locale's abbreviated month name. Example: Jan,
        Feb, ..., Dec.

    %B  Replaced by the C locale's full month name. Example: January,
        February, ..., December.

    %c  Replaced by the C locale's date and time representation. Equivalent
        to "%a %b %e %H:%M:%S %Y".

    %C  Replaced by the year divided by 100 and truncated to an integer, as
        a decimal number [00, 99].

    %d  Replaced by the day of the month as a decimal number [01, 31].

    %D  Equivalent to "%m/%d/%y".

    %e  Replaced by the day of the month as a decimal number [1, 31]; a
        single digit is preceded by a space.

    %f  Replaced by the fractional second including the preceding decimal
        point or by an empty string if no fractional seconds are present.
        This conversion specification permits use of an optional maximum
        field width [0, 9] where the default field width of 0 will use the
        shortest of the following representations:

            .fff        (millisecond)
            .ffffff     (microsecond)
            .fffffffff  (nanosecond)

        Example:

            $tm = Time::Moment->from_string('2012-12-24T15:30:45.123456Z');
            $tm->strftime('%f');    # '.123456'
            $tm->strftime('%3f');   # '.123'
            $tm->strftime('%9f');   # '.123456000'
    
            $tm = Time::Moment->from_string('2012-12-24T15:30:45Z');
            $tm->strftime('%f');    # ''
            $tm->strftime('%3f');   # ''

        %3f is replaced by decimal point and exactly three fractional digits
        (zero-padded on the right or truncated if needed) if fractional
        seconds are present.

        *This conversion specification is an extension to the "IEEE Std
        1003.1"
        <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.
        html>*.

    %F  Equivalent to "%Y-%m-%d".

    %g  Replaced by the last 2 digits of the year of the week as a decimal
        number [00, 99].

    %G  Replaced by the week-based year as a decimal number [0001, 9999].

    %h  Equivalent to %b.

    %H  Replaced by the hour of day (24-hour clock) as a decimal number [00,
        23].

    %I  Replaced by the hour of day (12-hour clock) as a decimal number [01,
        12].

    %j  Replaced by the day of the year as a decimal number [001, 366].

    %k  Replaced by the hour of day (24-hour clock) as a decimal number [1,
        23]; a single digit is preceded by a space.

        *This conversion specification is an extension to the "IEEE Std
        1003.1"
        <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.
        html>*.

    %l  Replaced by the hour of day (12-hour clock) as a decimal number [1,
        12]; a single digit is preceded by a space.

        *This conversion specification is an extension to the "IEEE Std
        1003.1"
        <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.
        html>*.

    %m  Replaced by the month of the year as a decimal number [01, 12].

    %M  Replaced by the minute of hour as a decimal number [00, 59].

    %n  Replaced by a <newline> character.

    %N  Replaced by the fractional second as a decimal number. This
        conversion specification permits use of an optional maximum field
        width [0, 9] where the default field width of 0 will use the
        shortest of the following representations:

            fff        (millisecond)
            ffffff     (microsecond)
            fffffffff  (nanosecond)

        Example:

            $tm = Time::Moment->from_string('2012-12-24T15:30:45.123456Z');
            $tm->strftime('%N');    # '123456'
            $tm->strftime('%3N');   # '123'
            $tm->strftime('%9N');   # '123456000'

        %3N is replaced by exactly three fractional digits (zero-padded on
        the right or truncated if needed).

        *This conversion specification is an extension to the "IEEE Std
        1003.1"
        <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.
        html>*.

    %p  Replaced by the C locale's meridian notation. Example: AM, PM.

    %r  Replaced by the C locale's time in a.m. and p.m. notation.
        Equivalent to "%I:%M:%S %p".

    %R  Replaced by the time in 24-hour notation. Equivalent to "%H:%M".

    %s  Replaced by the number of seconds from the epoch of
        1970-01-01T00:00:00Z as a decimal number.

        *This conversion specification is an extension to the "IEEE Std
        1003.1"
        <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.
        html>*.

    %S  Replaced by the second of hour as a decimal number [00, 59].

    %t  Replaced by a <tab> character.

    %T  Replaced by the time of day. Equivalent to "%H:%M:%S".

    %u  Replaced by the day of the week as a decimal number [1, 7], with 1
        representing Monday.

    %U  Replaced by the week number of the year as a decimal number [00,
        53]. The first Sunday of January is the first day of week 1; days in
        the new year before this are in week 0.

    %V  Replaced by the week number of the year (Monday as the first day of
        the week) as a decimal number [01, 53]. If the week containing 1
        January has four or more days in the new year, then it is considered
        week 1. Otherwise, it is the last week of the previous year, and the
        next week is week 1. Both January 4th and the first Thursday of
        January are always in week 1.

    %w  Replaced by the day of the week as a decimal number [0, 6], with 0
        representing Sunday.

    %W  Replaced by the week number of the year as a decimal number [00,
        53]. The first Monday of January is the first day of week 1; days in
        the new year before this are in week 0.

    %x  Replaced by the C locale's date representation. Equivalent to
        "%m/%d/%y".

    %X  Replaced by the C locale's time representation. Equivalent to
        "%H:%M:%S".

    %y  Replaced by the last two digits of the year as a decimal number [00,
        99].

    %Y  Replaced by the year as a decimal number [0001, 9999].

    %z  Replaced by the offset from UTC in the ISO 8601 basic format
        (±hhmm).

    %:z Replaced by the offset from UTC in the ISO 8601 extended format
        (±hh:mm).

    %Z  Replaced by the offset from UTC in the ISO 8601 extended format or
        by UTC designator (±hh:mm or Z).

    "%%"
        Replaced by %.

  length_of_year
        $integer = $tm->length_of_year;

    Returns the length of the year in days [365, 366].

  length_of_quarter
        $integer = $tm->length_of_quarter;

    Returns the length of the quarter of the year in days [90, 92].

  length_of_month
        $integer = $tm->length_of_month;

    Returns the length of the month of the year in days [28, 31].

  length_of_week_year
        $integer = $tm->length_of_week_year;

    Returns the length of the week of the year in weeks [52, 53].

  utc_rd_values
        ($rdn, $sod, $nanosecond) = $tm->utc_rd_values;

    Returns a list of three elements:

    $rdn
        The number of integral days from the Rata Die epoch of 0000-12-31.

    $sod
        The second of the day [0, 86_399].

    $nanosecond
        The nanosecond of the second [0, 999_999_999].

  utc_rd_as_seconds
        $seconds = $tm->utc_rd_as_seconds;

    Returns the number of integral seconds from the Rata Die epoch of
    0000-12-31T00:00:00Z.

  local_rd_values
        ($rdn, $sod, $nanosecond) = $tm->local_rd_values;

    Returns a list of three elements:

    $rdn
        The number of integral days from the Rata Die epoch of 0000-12-31.

    $sod
        The second of the day [0, 86_399].

    $nanosecond
        The nanosecond of the second [0, 999_999_999].

  local_rd_as_seconds
        $seconds = $tm->local_rd_as_seconds;

    Returns the number of integral seconds from the Rata Die epoch of
    0000-12-31T00:00:00.

OVERLOADED OPERATORS
  stringification
        $string = "$tm";

    The $string will be in one of the following representations:

        YYYY-MM-DDThh:mm:ss
        YYYY-MM-DDThh:mm:ss.fff
        YYYY-MM-DDThh:mm:ss.ffffff
        YYYY-MM-DDThh:mm:ss.fffffffff

    Followed by a zone designator in one of the following representations:

        Z
        ±hh:mm

    The shortest representation will be used where the omitted parts are
    implied to be zero. This representation is conformant with ISO 8601
    profiles, such as:

    *   RFC 3339 Date and Time on the Internet: Timestamps
        <http://tools.ietf.org/html/rfc3339>

    *   RFC 4287 The Atom Syndication Format
        <http://tools.ietf.org/html/rfc4287#section-3.3>

    *   W3C Date and Time Formats <http://www.w3.org/TR/NOTE-datetime>

    *   HTML5
        <http://www.w3.org/TR/html5/infrastructure.html#global-dates-and-tim
        es>

    *   XML Schema <http://www.w3.org/TR/xmlschema-2/#dateTime>

    The "to_string" method or the "strftime" format string
    "%Y-%m-%dT%H:%M:%S%f%Z" produces an equivalent string representation:

        "$tm" eq $tm->to_string;
        "$tm" eq $tm->strftime("%Y-%m-%dT%H:%M:%S%f%Z");

    The total length of the string representation will be between 20 and 35
    characters (inclusive).

  comparison
        $integer      = $tm1 <=> $tm2;
    
        $boolean      = $tm1 == $tm2;
        $boolean      = $tm1 != $tm2;
        $boolean      = $tm1 <  $tm2;
        $boolean      = $tm1 >  $tm2;
        $boolean      = $tm1 <= $tm2;
        $boolean      = $tm1 >= $tm2;

SERIALIZATION
  Storable
    The serialized representation of a "Time::Moment" is a string of 16
    bytes that contains MAGIC (2 bytes), time zone offset from UTC (2
    bytes), the number of days from Rata Die (4 bytes), second of the day (4
    bytes) and nanosecond of the second (4 bytes).

    The total size of the serialized "Time::Moment" instance using "nfreeze"
    is 34 bytes.

  JSON
    "Time::Moment" implements a "TO_JSON" method that returns the
    stringified representation of the instance.

  CBOR
    "Time::Moment" implements a "TO_CBOR" method that returns the
    stringified representation of the instance using tag 0 (*standard
    date/time string*).

    See CBOR::XS, RFC 7049 Section 2.4.1
    <http://tools.ietf.org/html/rfc7049#section-2.4.1> and "eg/cbor.pl" for
    an example how to roundtrip instances of "Time::Moment".

  Sereal
    Sereal version 2.030 or later implements support for the generic
    serialization protocol "FREEZE/THAW".

  FREEZE/THAW
    "Time::Moment" implements a "FREEZE" method that returns the stringified
    representation of the instance and a "THAW" method according to the
    serialization protocol specified in Types::Serialiser.

EXAMPLE FORMAT STRINGS
  ISO 8601 - Data elements and interchange formats
   Date
    Calendar date - 24 December 2012

        Basic format:               Example:
        %Y%m%d                      20121224
        %y%m                        201212      (reduced accuracy)

        Extended format:            Example:
        %Y-%m-%d                    2012-12-24
        %Y-%m                       2012-12     (reduced accuracy)

    Ordinal date - 24 December 2012

        Basic format:               Example:
        %Y%j                        2012359
    
        Extended format:            Example:
        %Y-%j                       2012-359

    Week date - Monday, 24 December 2012

        Basic format:               Example:
        %GW%V%u                     2012W521
        %GW%V                       2012W52     (reduced accuracy)

        Extended format:            Example:
        %G-W%V-%u                   2012-W52-1
        %G-W%V                      2012-W52    (reduced accuracy)

   Time of day
    Local time - 30 minutes and 45 seconds past 15 hours

        Basic format:               Example:
        %H%M%S                      153045
        %H%M                        1530        (reduced accuracy)

        Extended format:            Example:
        %H:%M:%S                    15:30:45
        %H:%M                       15:30       (reduced accuracy)

    Local time with decimal fractions - 30 minutes and 45 and a half second
    past 15 hours

        Basic format:               Example:
        %H%M%S%f                    153045.500
        %H%M%S.%1N                  153045.5

        Extended format:            Example:
        %H:%M:%S%f                  15:30:45.500
        %H:%M:%S.%1N                15:30:45.5

    Local time and the difference from UTC - 30 minutes and 45 seconds past
    15 hours, one hour ahead of UTC

        Basic format:               Example:
        %H%M%S%z                    153045+0100

        Extended format:            Example:
        %H:%M:%S%Z                  15:30:45+01:00

   Date and time of day
    Combinations of calendar date and time of day

        Basic format:               Example:
        %Y%m%dT%H%M%S%z             20121224T153045+0100
        %Y%m%dT%H%M%S%f%z           20121224T153045.500+0100
        %Y%m%dT%H%M%z               20121224T1530+0100      (reduced accuracy)

        Extended format:            Example:
        %Y-%m-%dT%H:%M:%S%Z         2012-12-24T15:30:45+01:00
        %Y-%m-%dT%H:%M:%S%f%Z       2012-12-24T15:30:45.500+01:00
        %Y-%m-%dT%H:%M%Z            2012-12-24T15:30+01:00  (reduced accuracy)

    Combinations of ordinal date and time of day

        Basic format:               Example:
        %Y%jT%H%M%S%z               2012359T153045+0100
        %Y%jT%H%M%S%f%z             2012359T153045.500+0100
        %Y%jT%H%M%z                 2012359T1530+0100       (reduced accuracy)

        Extended format:            Example:
        %Y-%jT%H:%M:%S%Z            2012-359T15:30:45+01:00
        %Y-%jT%H:%M:%S%f%Z          2012-359T15:30:45.500+01:00
        %Y-%jT%H:%M%Z               2012-359T15:30+01:00    (reduced accuracy)

    Combinations of week date and time of day

        Basic format:               Example:
        %GW%V%uT%H%M%S%z            2012W521T153045+0100
        %GW%V%uT%H%M%S%f%z          2012W521T153045.500+0100
        %GW%V%uT%H%M%f%z            2012W521T1530+0100      (reduced accuracy)

        Extended format:            Example:
        %G-W%V-%uT%H:%M:%S%Z        2012-W52-1T15:30:45+01:00
        %G-W%V-%uT%H:%M:%S%f%Z      2012-W52-1T15:30:45.500+01:00
        %G-W%V-%uT%H:%M%Z           2012-W52-1T15:30+01:00  (reduced accuracy)

  ISO 9075 - Information technology - Database languages - SQL
    Literal values from Part 2: Foundation (SQL/Foundation)

        Date:                       Example:
        %Y-%m-%d                    2012-12-24
    
        Time:                       Example:
        %H:%M:%S                    15:30:45
        %H:%M:%S%f                  15:30:45.500
    
        Timestamp:                  Example:
        %Y-%m-%d %H:%M:%S           2012-12-24 15:30:45
        %Y-%m-%d %H:%M:%S %:z       2012-12-24 15:30:45 +01:00
        %Y-%m-%d %H:%M:%S%f         2012-12-24 15:30:45.500
        %Y-%m-%d %H:%M:%S%f %:z     2012-12-24 15:30:45.500 +01:00

  RFC 1123 - Requirements for Internet Hosts
    RFC 822 <http://tools.ietf.org/html/rfc822#section-5> as updated by RFC
    1123 <http://tools.ietf.org/html/rfc1123>.

        Format:                     Example:
        %a, %d %b %Y %H:%M:%S %z    Mon, 24 Dec 2012 15:30:45 +0100

  RFC 2616 - HTTP/1.1
    RFC 2616 - 3.3.1 Full Date
    <http://tools.ietf.org/html/rfc2616#section-3.3.1>.

        Format:                     Example:
        %a, %d %b %Y %H:%M:%S GMT   Mon, 24 Dec 2012 14:30:45 GMT

    An HTTP date value represents time as an instance of UTC:

        $string = $tm->at_utc->strftime("%a, %d %b %Y %H:%M:%S GMT");

  RFC 5322 - Internet Message Format
    RFC 5322 - 3.3. Date and Time Specification
    <http://tools.ietf.org/html/rfc5322#section-3.3>.

        Format:                     Example:
        %a, %d %b %Y %H:%M:%S %z    Mon, 24 Dec 2012 15:30:45 +0100
        %a, %d %b %Y %H:%M %z       Mon, 24 Dec 2012 15:30 +0100
        %d %b %Y %H:%M:%S %z        24 Dec 2012 15:30:45 +0100
        %d %b %Y %H:%M %z           24 Dec 2012 15:30 +0100

TIME ZONES
    An instance of "Time::Moment" represents an unambiguous point in time,
    but it's not time zone aware. When performing arithmetic on the local
    date/time or altering the components of the local date/time it may be
    necessary to use a time zone to convert to the correct representation.

    "Time::Moment" is API compatible with DateTime::TimeZone and
    DateTime::TimeZone::Tzfile.

  Converting from instant time to designated time zone
        $tm = Time::Moment->new(
            year   => 2012,
            month  => 12,
            day    => 24,
            hour   => 15
        );
        $zone   = DateTime::TimeZone->new(name => 'America/New_York');
        $offset = $zone->offset_for_datetime($tm) / 60;
    
        say $tm->with_offset_same_instant($offset); # 2012-12-24T10-05

  Converting from local time to designated time zone
        $tm = Time::Moment->new(
            year   => 2012,
            month  => 12,
            day    => 24,
            hour   => 15
        );
        $zone   = DateTime::TimeZone->new(name => 'America/New_York');
        $offset = $zone->offset_for_local_datetime($tm) / 60;
    
        say $tm->with_offset_same_local($offset); # 2012-12-24T15-05

  The Effect of Daylight Saving Time
    The time zone *Europe/Brussels* has 01:00 UTC as standard time, and
    02:00 UTC as daylight savings time, with transition dates according to
    the European Summer Time
    <http://en.wikipedia.org/wiki/Summer_Time_in_Europe>.

        $zone = DateTime::TimeZone->new(name => 'Europe/Brussels');
    
        sub convert_from_instant {
            my ($tm, $zone) = @_;
            my $offset = $zone->offset_for_datetime($tm) / 60;
            return $tm->with_offset_same_instant($offset);
        }
    
        sub convert_from_local {
            my ($tm, $zone) = @_;
            my $offset = $zone->offset_for_local_datetime($tm) / 60;
            return $tm->with_offset_same_local($offset);
        }

    European Summer Time begins (clocks go forward) at 01:00 UTC on the last
    Sunday in March, in 2014 the transition date was March 30.

        $tm1 = Time::Moment->from_string('2014-03-29T12+01');
        $tm2 = $tm1->plus_hours(24);
        say convert_from_instant($tm2, $zone); # 2014-03-30T13+02
        say convert_from_local($tm2, $zone);   # 2014-03-30T12+02

    During the transition from standard time to daylight savings time, the
    local time interval between 02:00:00 and 02:59:59 does not exist. Local
    time values in that interval are invalid. "DateTime::TimeZone" raises an
    exception when attempting to convert non-existing local time.

        $tm1 = Time::Moment->from_string('2014-03-29T22+01');
        $tm2 = $tm1->plus_hours(4);
        say convert_from_instant($tm2, $zone); # 2014-03-30T03+02
        say convert_from_local($tm2, $zone);   # raises an exception

    European Summer Time ends (clocks go backward) at 01:00 UTC on the last
    Sunday in October, in 2014 the transition date was October 26.

        $tm1 = Time::Moment->from_string('2014-10-25T12+02');
        $tm2 = $tm1->plus_hours(24);
        say convert_from_instant($tm2, $zone); # 2014-10-26T11+01
        say convert_from_local($tm2, $zone);   # 2014-10-26T12+01

    During the transition from daylight savings time to standard time, the
    local time interval between 02:00:00 and 02:59:59 is repeated. Local
    time values in that interval are ambiguous because they occur twice.
    When "DateTime::TimeZone" converts an ambiguous local time it returns
    the numerically lowest offset (usually the standard one).

        $tm1 = Time::Moment->from_string('2014-10-25T22+02');
        $tm2 = $tm1->plus_hours(4);
        say convert_from_instant($tm2, $zone); # 2014-10-26T02+02
        say convert_from_local($tm2, $zone);   # 2014-10-26T02+01

DIAGNOSTICS
    (F) Usage: %s
        Method called with wrong number of arguments.

    (F) Parameter '%s' is out of range
    (F) Parameter '%s' is out of the range [%d, %d]
    (F) Cannot coerce object of type %s to Time::Moment
    (F) Could not parse the given string
    (F) %s is not an instance of Time::Moment
    (F) A %s object can only be compared to another %s object ('%s', '%s')

THREAD SAFETY
    "Time::Moment" is thread safe.

SEE ALSO
    DateTime

    Time::Piece

SUPPORT
  Bugs / Feature Requests
    Please report any bugs or feature requests through the issue tracker at
    <https://github.com/chansen/p5-time-moment/issues>. You will be notified
    automatically of any progress on your issue.

  SOURCE CODE
    This is open source software. The code repository is available for
    public review and contribution under the terms of the license.

    <https://github.com/chansen/p5-time-moment>

        git clone https://github.com/chansen/p5-time-moment

AUTHOR
    Christian Hansen "chansen@cpan.org"

COPYRIGHT
    Copyright 2013-2016 by Christian Hansen.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.