--- a/Timestamp.st Sat Oct 31 06:41:00 2015 +0100
+++ b/Timestamp.st Tue Nov 10 07:06:23 2015 +0100
@@ -382,6 +382,24 @@
"
"Modified (comment): / 20-08-2011 / 16:52:10 / cg"
+!
+
+year: year month: month day: day hour: hour minute: minute second: second millisecond: millisecond offset:timeDuration
+ ^ (UtcTimestamp year: year month: month day: day hour: hour minute: minute second: second millisecond: millisecond)
+ utcOffset:timeDuration
+
+ "
+ Timestamp year:2015 month:11 day:9 hour:12 minute:0 second:0 millisecond:0 offset:(2 hours)
+ "
+!
+
+year: year month: month day: day hour: hour minute: minute second: second offset:timeDuration
+ ^ (UtcTimestamp year: year month: month day: day hour: hour minute: minute second: second)
+ utcOffset:timeDuration
+
+ "
+ Timestamp year:2015 month:11 day:9 hour:12 minute:0 second:0 offset:(2 hours)
+ "
! !
!Timestamp class methodsFor:'format strings'!
@@ -1838,6 +1856,17 @@
"Modified: 1.7.1996 / 15:23:05 / cg"
!
+monthIndex
+ "return the month of the receiver (1..12).
+ For compatibility"
+
+ ^ self asDate monthIndex.
+
+ "
+ Timestamp now monthIndex
+ "
+!
+
osTime
"get the internal representation of the time.
Warning: do not depend on the value (unix vs. win32 - differences)"
@@ -2292,6 +2321,15 @@
^ self
!
+asUTC
+ ^ self asUtcTimestamp
+
+ "
+ Timestamp now
+ Timestamp now asUTC
+ "
+!
+
asUtcTimestamp
"return a timestamp which represents the very same timestamp,
but will represent itself as a timestamp in the UTC timezone"
@@ -2328,6 +2366,24 @@
"
!
+utcOffset:anOffset
+ "answer a DateTime equivalent to the receiver but offset from UTC by offset"
+
+ ^ TZTimestamp new
+ osTime:osTime;
+ utcOffset:(anOffset asTimeDuration)
+
+ "
+ Timestamp now -- now as local time
+ Timestamp now asTZTimestamp -- now in your local timezone
+ Timestamp now asUtcTimestamp -- now in greenwich
+ UtcTimestamp now -- now in greenwich
+ Timestamp now utcOffset:(-2 hours)2015-11-09 17:29:35.803+02 -- now in East Europe
+ Timestamp now utcOffset:(5 hours) -- now in Eastern time
+ Timestamp now asTZTimestampInZone:'EST' -- now in Eastern time
+ "
+!
+
utcSecondsSince1901
"return the number of seconds elapsed since Jan, 1st 1901"
@@ -2980,7 +3036,6 @@
"
! !
-
!Timestamp methodsFor:'testing'!
isLocalTimestamp