93 ! |
93 ! |
94 |
94 |
95 hour:h minute:m |
95 hour:h minute:m |
96 "compatibility" |
96 "compatibility" |
97 |
97 |
|
98 <resource:#obsolete> |
|
99 |
|
100 self obsoleteMethodWarning:'use #hours:minutes:seconds:'. |
|
101 |
98 ^ self hours:h minutes:m seconds:0 |
102 ^ self hours:h minutes:m seconds:0 |
99 |
103 |
100 " |
104 " |
101 Time hour:2 minute:33 |
105 Time hour:2 minute:33 |
102 " |
106 " |
|
107 |
|
108 "Modified: / 17-07-2017 / 14:04:39 / cg" |
103 ! |
109 ! |
104 |
110 |
105 hour:h minute:m second:s |
111 hour:h minute:m second:s |
106 "compatibility" |
112 "compatibility" |
107 |
113 |
|
114 <resource:#obsolete> |
|
115 |
|
116 self obsoleteMethodWarning:'use #hours:minutes:seconds:'. |
|
117 |
108 ^ self hours:h minutes:m seconds:s |
118 ^ self hours:h minutes:m seconds:s |
109 |
119 |
110 " |
120 " |
111 Time hour:2 minute:33 second:0 |
121 Time hour:2 minute:33 second:0 |
112 " |
122 " |
|
123 |
|
124 "Modified: / 17-07-2017 / 14:04:34 / cg" |
113 ! |
125 ! |
114 |
126 |
115 hour:h minutes:m seconds:s |
127 hour:h minutes:m seconds:s |
116 "return an instance of Time representing the given time. |
128 "return an instance of Time representing the given time. |
117 See also Time now / Date today / Timestamp now. |
129 See also Time now / Date today / Timestamp now. |
129 Time hours:24 minutes:0 seconds:0 |
141 Time hours:24 minutes:0 seconds:0 |
130 Time hours23 minutes:59 seconds:59 |
142 Time hours23 minutes:59 seconds:59 |
131 " |
143 " |
132 |
144 |
133 "Modified: 19.4.1996 / 15:32:40 / cg" |
145 "Modified: 19.4.1996 / 15:32:40 / cg" |
|
146 ! |
|
147 |
|
148 hours:h minutes:m |
|
149 "return a new TimeDuration representing a duration of h hours and m minutes. |
|
150 See also Time now / Date today / Timestamp now." |
|
151 |
|
152 ^ self basicNew setHours:h minutes:m seconds:0 milliseconds:0 |
|
153 |
|
154 " |
|
155 TimeDuration hours:2 minutes:33 |
|
156 TimeDuration hours:100 minutes:33 |
|
157 " |
134 ! |
158 ! |
135 |
159 |
136 hours:h minutes:m seconds:s |
160 hours:h minutes:m seconds:s |
137 "return an instance of Time representing the given time. |
161 "return an instance of Time representing the given time. |
138 See also Time now / Date today / Timestamp now." |
162 See also Time now / Date today / Timestamp now." |
789 The date components are taken from today." |
815 The date components are taken from today." |
790 |
816 |
791 |todayTimestamp| |
817 |todayTimestamp| |
792 |
818 |
793 todayTimestamp := Timestamp now. |
819 todayTimestamp := Timestamp now. |
794 todayTimestamp year:todayTimestamp year month:todayTimestamp month day:todayTimestamp day |
820 todayTimestamp |
795 hour:(self hours) minute:(self minutes) second:(self seconds) |
821 year:todayTimestamp year |
796 millisecond:(self milliseconds). |
822 month:todayTimestamp month |
|
823 day:todayTimestamp day |
|
824 hour:(self hours) |
|
825 minute:(self minutes) |
|
826 second:(self seconds) |
|
827 millisecond:(self milliseconds). |
797 |
828 |
798 ^ todayTimestamp. |
829 ^ todayTimestamp. |
799 |
830 |
800 " |
831 " |
801 Time now asLocalTimestamp |
832 Time now asLocalTimestamp |
802 " |
833 " |
|
834 |
|
835 "Modified (format): / 17-07-2017 / 14:07:27 / cg" |
|
836 ! |
|
837 |
|
838 asTZTimestamp |
|
839 "return a TZTimestamp object from the receiver. |
|
840 This includes the local timezone information." |
|
841 |
|
842 ^ self asLocalTimestamp asTZTimestamp. |
|
843 |
|
844 " |
|
845 Time now asTZTimestamp -> 2017-07-17 14:11:16+02 |
|
846 Time now asUtcTimestamp -> 2017-07-17 12:11:16Z |
|
847 Time now asLocalTimestamp -> 2017-07-17 14:11:16 |
|
848 " |
|
849 |
|
850 "Created: / 17-07-2017 / 14:11:14 / cg" |
803 ! |
851 ! |
804 |
852 |
805 asTime |
853 asTime |
806 "return a Time object from the receiver - that's the receiver." |
854 "return a Time object from the receiver - that's the receiver." |
807 |
855 |
808 ^ self |
856 self class == Time ifTrue:[ |
|
857 ^ self |
|
858 ]. |
|
859 ^ super asTime |
|
860 |
|
861 "Modified: / 17-07-2017 / 14:06:53 / cg" |
809 ! |
862 ! |
810 |
863 |
811 asTimeDuration |
864 asTimeDuration |
812 "return an TimeDuration object from the receiver, taking the time since midnight." |
865 "return an TimeDuration object from the receiver, taking the time since midnight." |
813 |
866 |
833 asUtcTimestamp |
886 asUtcTimestamp |
834 "return an UtcTimestamp object from the receiver. |
887 "return an UtcTimestamp object from the receiver. |
835 So I am interpreted as a Time in the UTC zone. |
888 So I am interpreted as a Time in the UTC zone. |
836 The date components are taken from today." |
889 The date components are taken from today." |
837 |
890 |
838 |todayTimestamp| |
891 ^ self asLocalTimestamp asUtcTimestamp. |
839 |
892 |
840 todayTimestamp := Timestamp now. |
893 " |
841 todayTimestamp year:todayTimestamp year month:todayTimestamp month day:todayTimestamp day |
894 Time now asTimestamp -> 2017-07-17 14:08:22 |
842 hour:(self hours) minute:(self minutes) second:(self seconds) |
895 Time now asLocalTimestamp -> 2017-07-17 14:08:24 |
843 millisecond:(self milliseconds). |
896 Time now asUtcTimestamp -> 2017-07-17 12:08:27Z |
844 |
897 " |
845 ^ todayTimestamp asUtcTimestamp. |
898 |
846 |
899 "Modified (comment): / 17-07-2017 / 14:09:45 / cg" |
847 " |
|
848 Time now asUtcTimestamp |
|
849 " |
|
850 ! ! |
900 ! ! |
851 |
901 |
852 !Time methodsFor:'printing & storing'! |
902 !Time methodsFor:'printing & storing'! |
853 |
903 |
854 print12HourFormatOn:aStream |
904 print12HourFormatOn:aStream |