Back: Date-testing
Up: Class reference
Forward: DateTime class-information
 
Top: GNU Smalltalk User's Guide
Contents: Table of Contents
Index: Class index
About: About this document

6.53 DateTime

Defined in namespace Smalltalk
Category: Language-Data types
My instances represent timestamps.

6.53.1 DateTime class: information  (class)
6.53.2 DateTime class: instance creation  (class)
6.53.3 DateTime class: instance creation (non-ANSI)  (class)
6.53.4 DateTime: basic  (instance)
6.53.5 DateTime: computations  (instance)
6.53.6 DateTime: printing  (instance)
6.53.7 DateTime: splitting in dates & times  (instance)
6.53.8 DateTime: storing  (instance)
6.53.9 DateTime: testing  (instance)
6.53.10 DateTime: time zones  (instance)


6.53.1 DateTime class: information

clockPrecision
Answer `ClockPrecision'.

initialize
Initialize the receiver's class variables


6.53.2 DateTime class: instance creation

now
Answer an instance of the receiver referring to the current date and time.

readFrom: aStream
Parse an instance of the receiver from aStream

year: y day: d hour: h minute: min second: s
Answer a DateTime denoting the d-th day of the given year, and setting the time part to the given hour, minute, and second

year: y day: d hour: h minute: min second: s offset: ofs
Answer a DateTime denoting the d-th day of the given year. Set the offset field to ofs (a Duration), and the time part to the given hour, minute, and second

year: y month: m day: d hour: h minute: min second: s
Answer a DateTime denoting the d-th day of the given (as a number) month and year, setting the time part to the given hour, minute, and second

year: y month: m day: d hour: h minute: min second: s offset: ofs
Answer a DateTime denoting the d-th day of the given (as a number) month and year. Set the offset field to ofs (a Duration), and the the time part to the given hour, minute, and second


6.53.3 DateTime class: instance creation (non-ANSI)

fromDays: days seconds: secs offset: ofs
Answer a DateTime denoting the d-th day of the given (as a number) month and year. Set the offset field to ofs (a Duration), and the the time part to the given hour, minute, and second


6.53.4 DateTime: basic

+ aDuration
Answer a new Date pointing dayCount past the receiver

- aDateTimeOrDuration
Answer a new Date pointing dayCount before the receiver


6.53.5 DateTime: computations

asSeconds
Answer the date as the number of seconds from 1/1/1901.

dayOfWeek
Answer the day of week of the receiver. Unlike Dates, DateAndTimes have 1 = Sunday, 7 = Saturday

hour
Answer the hour in a 24-hour clock

hour12
Answer the hour in a 12-hour clock

hour24
Answer the hour in a 24-hour clock

meridianAbbreviation
Answer either #AM (for anti-meridian) or #PM (for post-meridian)

minute
Answer the minute

second
Answer the month represented by the receiver


6.53.6 DateTime: printing

printOn: aStream
Print a representation for the receiver on aStream


6.53.7 DateTime: splitting in dates & times

asDate
Answer a Date referring to the same day as the receiver

asTime
Answer a Time referring to the same time (from midnight) as the receiver

at: anIndex
Since in the past timestamps were referred to as Arrays containing a Date and a Time (in this order), this method provides access to DateTime objects like if they were two-element Arrays.


6.53.8 DateTime: storing

storeOn: aStream
Store on aStream Smalltalk code compiling to the receiver


6.53.9 DateTime: testing

< aDateTime
Answer whether the receiver indicates a date preceding aDate

= aDateTime
Answer whether the receiver indicates the same date as aDate

hash
Answer an hash value for the receievr


6.53.10 DateTime: time zones

asLocal
Answer the receiver, since DateTime objects store themselves in Local time

asUTC
Convert the receiver to UTC time, and answer a new DateTime object.

offset
Answer the receiver's offset from UTC to local time (e.g. +3600 seconds for Central Europe Time, -3600*6 seconds for Eastern Standard Time). The offset is expressed as a Duration

offset: anOffset
Answer a copy of the receiver with the offset from UTC to local time changed to anOffset (a Duration).

timeZoneAbbreviation
Answer an abbreviated indication of the receiver's offset, expressed as `shhmm', where `hh' is the number of hours and `mm' is the number of minutes between UTC and local time, and `s' can be `+' for the Eastern hemisphere and `-' for the Western hemisphere.

timeZoneName
Answer the time zone name for the receiver (currently, it is simply `GMT +xxxx', where `xxxx' is the receiver's #timeZoneAbbreviation).




This document was generated on May, 12 2002 using texi2html