Date and Time API Functions: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 25.x)
Zur Navigation springen Zur Suche springen
Inhalt gelöscht Inhalt hinzugefügt
Zeile 35: Zeile 35:


==== Arithmetic ====
==== Arithmetic ====
''aDate'' <code>addDays:</code> ''nDays'' => a date<br>
''aDate'' <code>addDays:</code> ''numDays'' => a date<br>
::to compute dates
::to compute a date numDays after aDate
''aDate'' <code>subtractDays:</code> ''numDays'' => a date<br>
::to compute a date numDays before aDate; for example: "(Date today subtractDays:7)"
''aDate'' <code>subtractDate:</code> ''date2'' => nr of days<br>
::to compute the number of days since 1.1.1900, use: "(Date today subtractDate:(Date year:1900 month:1 day:1))"


==== Accessing ====
==== Accessing ====

Version vom 5. Januar 2022, 17:39 Uhr

This document lists most useful (and most often needed) functions. Be aware, that there are many more to be found in either the class references or via the builtin class browser.

Reference: Date Time Timestamp TimeDuration

Back to Useful API Functions

Time

Time instances represent a time-of-day (i.e. "hh:mm:ss" within a single day). Times are seldom used - usually timestamps are better suited.

Creation

Time now => a time

provides the current time of day

Arithmetic

aTime addSeconds: nSeconds => a time
aTime addMinutes: nMinutes => a time
aTime addHours: nHours => a time

to compute times

Accessing

aTime hours => hours (0..24) aTime minutes => hours (0..59) aTime seconds => hours (0..59)

to retrieve the hour, minute and second component:

Date

Date instances represent a date (i.e. "dd-mm-yyyy"). Dates are seldom used - usually timestamps are better suited.

Creation

Date today => a date

provides the current date

Arithmetic

aDate addDays: numDays => a date

to compute a date numDays after aDate

aDate subtractDays: numDays => a date

to compute a date numDays before aDate; for example: "(Date today subtractDays:7)"

aDate subtractDate: date2 => nr of days

to compute the number of days since 1.1.1900, use: "(Date today subtractDate:(Date year:1900 month:1 day:1))"

Accessing

aDate day => day (1..31) aDate month => month (1..12) aDate year => year

to retrieve date components.

Timestamp

Timestamp instances represent a particular point in time. (i.e. "dd-mm-yyyy hh:mm:ss").

Creation

Timestamp now => a timestamp

provides the current timestamp

TimeDuration

Timeduration instances represent a time-delta. (i.e. seconds).



Copyright © 2014-2024 eXept Software AG