Back: Date-testing Up: Base classes Forward: DateTime class-information   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document

1.59 DateTime

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

1.59.1 DateTime class: information  (class)
1.59.2 DateTime class: instance creation  (class)
1.59.3 DateTime class: instance creation (non-ANSI)  (class)
1.59.4 DateTime: basic  (instance)
1.59.5 DateTime: computations  (instance)
1.59.6 DateTime: printing  (instance)
1.59.7 DateTime: splitting in dates & times  (instance)
1.59.8 DateTime: storing  (instance)
1.59.9 DateTime: testing  (instance)
1.59.10 DateTime: time zones  (instance)


1.59.1 DateTime class: information

clockPrecision
Answer `ClockPrecision'.

initialize
Initialize the receiver's class variables


1.59.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

today
Answer an instance of the receiver referring to midnight of today in local time.

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


1.59.3 DateTime class: instance creation (non-ANSI)

date: aDate time: aTime
Answer a DateTime denoting the given date and time. Set the offset field to ofs (a Duration).

date: aDate time: aTime offset: ofs
Answer a DateTime denoting the given date and time. Set the offset field to ofs (a Duration).

fromDays: days seconds: secs
Answer a DateTime denoting the given date (as days since January 1, 1901) and time (as seconds since UTC midnight).

fromDays: days seconds: secs offset: ofs
Answer a DateTime denoting the given date (as days since January 1, 1901) and time (as seconds since midnight). Set the offset field to ofs (a Duration).

fromSeconds: secs
Answer a DateTime denoting the given date and time (as seconds since January 1, 1901 midnight UTC).

fromSeconds: secs offset: ofs
Answer a DateTime denoting the given date and time (as seconds since January 1, 1901 midnight). Set the offset field to ofs (a Duration).


1.59.4 DateTime: basic

+ aDuration
Answer a new Date pointing aDuration time past the receiver

- aDateTimeOrDuration
Answer a new Date pointing dayCount before the receiver


1.59.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


1.59.6 DateTime: printing

printOn: aStream
Print a representation for the receiver on aStream


1.59.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.


1.59.8 DateTime: storing

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


1.59.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


1.59.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).



Back: DateTime-testing Up: DateTime Forward: DeferredVariableBinding   Top: GNU Smalltalk Library Reference Contents: Table of Contents Index: Class index About: About this document


This document was generated on April, 16 2013 using texi2html