[squeak-dev] Re: Date[And]Time fractional seconds printing

Bernhard Pieber bernhard at pieber.com
Sun Aug 29 11:15:43 UTC 2010


For what it's worth, here the relevant extract from the ANSI Standard:

5.8.1.24	Message Refinement:	printString
Synopsis
Return a string that describes the receiver.
Definition: <Object>
A string consisting of a sequence of characters that describe the receiver are returned as the result.
The exact sequence of characters that describe an object are implementation defined.
Refinement: <DateAndTime>
The returned string will represent the UTC time of the receiver offset from UTC by the offset of the receiver. All dates are in the astronomical Gregorian calendar. The result will be formatted as
-YYYY-MM-DDThh:mm:ss.s+ZZ:zz:z where -	is the <Character> $- if the year is less than 0 otherwise it is the <Character> that is
returned from the message #space sent to the standard global Character,
YYYY	is the year left zero filled to four places,
-	is the <Character> $-,
MM	is the month of the year left zero filled to two places,
-	is the <Character> $-,
DD	is the day of the month left zero filled to two places,
T	is the <Character> $T,
hh	is the hour in the 24-hour clock left zero filled to two places,
:	is the <Character> $:,
mm	is the minute left zero filled to two places,
:	is the <Character> $:,
ss	is the second left zero filled to two places,
.	is the <Character> $. and is present only if the fraction of a second is non-zero,
s	is the fraction of a second and is present only if non-zero,
+	is the <Character> $+ if the offset is greater than or equal to <Duration factory> #zero and the <Character> $- if it is less,
ZZ	is the hours of the offset left zero filled to two places, and :	is the <Character> $:, zz	is the minutes of the offset left zero filled to two places, :	is the <Character> $: and is present only if the seconds of the offset is non-zero,
z	is the seconds of the offset including any fractional part and is present only if non- zero.
This format is based on ISO 8601 sections 5.3.3 and 5.4.1.
Example: 8:33:14.321 PM EST January 5, 1200 B.C.
'-1199-01-05T20:33:14.321-05:00'
Example: 12 midnight UTC January 1, 2001 A.D.
' 2001-01-01T00:00:00+00:00'
Return Values
<readableString> unspecified
Errors
none

Cheers,
Bernhard

Am 29.08.2010 um 12:49 schrieb Bernhard Pieber:

> Hi Andreas,
> 
> Am 29.08.2010 um 04:18 schrieb Andreas Raab:
>> BTW, does anyone know what the result of "Date[And]Time now" is in other systems? What do VW, GST, and others return? Whole seconds or fractional?
> 
> On VA Smalltalk 8.0.2 I get the following when I print it:
> DateAndTime now 2010-08-29T12:47:26.778+01:00
> 
> Cheers,
> Bernhard

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20100829/e049d4dc/attachment.htm


More information about the Squeak-dev mailing list