[Glass] Timespan Month questions

Trussardi Dario Romano via Glass glass at lists.gemtalksystems.com
Thu Jun 25 07:32:48 PDT 2015


Ciao Johan,

	thanks.

> Hi Dario,
> 
> What timezone is your image configured in? 
> 
> 	TimeZone current standardPrintString

	My environment is set to:		 'Germany Standard Time'
	
> 
> DateAndTime in GemStone take the DST (daylight saving time) into account.
> If you create a DateAndTime on a particular date, it will automatically adapt the offset to UTC to reflect that.
> 
> April 1st is still winter time (UTC+1) and April 30th is summer time (UTC+2). 
> In Belgium this happens is in March, so I am a bit surprised about the dates you report, which is why I ask which timezone you are in.

	Into GemTools workspace  the code:	 ( Month starting: ( Date fromString: '04.01.2015' )) end
 
	answer:			2015-04-30T23:59:59.99999898672104+02:00

> 
> Mind that the two datetimes you mention are _not_ the same (see the value of seconds). 
> Comparing datetimes from different timezones works relative to UTC time. 
> 
> Does that answer your question?

	I use the:	( Month starting: ( Date fromString: '04.01.2015' )) end

	   -> 2015-04-30T23:59:59.99999898672104+02:00
>> 		(class)@ -> DateAndTime
>> 
>> 		(oop)@   -> 231902721
>> 
>> 		offset@  -> 7200
>> 
>> 	{ a} 	seconds@ -> 4,521 239 9999999899E+08
>> 
	
		for select all records relative to the month.


	aRecord aDateAndTime < ( Month starting: ( Date fromString: '04.01.2015' )) end

	But the last record of April:

		{b} .        -> 2015-04-30T23:59:59.99999898672104+01:00
>> 			(class)@ -> DateAndTime
>> 
>> 			(oop)@   -> 324726017
>> 
>> 			offset@  -> 3600
>> 
>> 			seconds@ -> 4,521 275 9999999899E+08
>> 

	 is not select.


The 	DateAndTimeANSI  <  method  report:

	< aDateAndTime
  "Synopsis
	Answer true if the receiver is less than operand. Answer false otherwise.
	Definition: <magnitude>
	Answer true if the receiver is less than operand with respect to the ordering defined for them.
	Answer false otherwise.
	It is erroneous if the receiver and operand are not comparable.
	The semantics of the natural ordering must be defined by refinement, which may also restrict the
	type of operand.
	Refinement: <DateAndTime>
	Answer true if the UTC time represented by operand follows the UTC time represented by the
	receiver. Answer false otherwise.
	If the offsets of the receiver and operand are the same then their order is determined by their
	lexical order in the sequence #year, #month, #day, #hour24, #minute, #second. If their
	offsets differ then result is the same as if receiver asUTC < operand asUTC were evaluated."

  ^ self asSeconds < aDateAndTime asSeconds

Where asSeconds   answer:	 ^ seconds


but { b seconds }  is not 	<  of { a seconds }

	
Thanks for any considerations.

	Dario

> 
> cheers
> Johan
> 
> 
> 
>> On 25 Jun 2015, at 12:01, Trussardi Dario Romano via Glass <glass at lists.gemtalksystems.com> wrote:
>> 
>> Ciao,
>> 
>> 	i have a problem when i use a Month class into glass.
>> 
>> 	The	:		( Month starting: ( Date fromString: '04.01.2015' )) 
>> 
>> 	answer the:
>> 
>> 	{c} .         -> April 2015
>> 		(class)@  -> Month
>> 
>> 		(oop)@    -> 186660865
>> 
>> 		duration@ -> 30:00:00:00
>> 
>> 		start@    -> 2015-04-01T00:00:00+01:00
>> 
>> 	The relative start@ is set to:
>> 
>> 
>> 		.        -> 2015-04-01T00:00:00+01:00
>> 			..       -> April 2015
>> 
>> 			(class)@ -> DateAndTime
>> 
>> 			(oop)@   -> 231252225
>> 
>> 			offset@  -> 3600					( NOTE IT'S SET TO 3600 )
>> 
>> 			seconds@ -> 449535600
>> 
>>  
>> 
>> 
>> 	Now when i do:	( Month starting: ( Date fromString: '04.01.2015' )) end
>> 
>> 		the system answer:
>> 
>> 	.        -> 2015-04-30T23:59:59.99999898672104+02:00
>> 		(class)@ -> DateAndTime
>> 
>> 		(oop)@   -> 231902721
>> 
>> 		offset@  -> 7200
>> 
>> 		seconds@ -> 4,5212399999999899E+08
>> 
>>  
>> 
>> 	I don't understund because the end method answer aDateAndTime with offset set to 7200.
>> 
>> 	
>> 	After what in my code  i have two DateAndTime instance relative to the same " time " :
>> 
>> 	{a} .        -> 2015-04-30T23:59:59.99999898672104+02:00
>> 			(class)@ -> DateAndTime
>> 
>> 			(oop)@   -> 324717569
>> 
>> 			offset@  -> 7200
>> 
>> 			seconds@ -> 4,5212399999999899E+08
>> 
>> 
>> 	{b} .        -> 2015-04-30T23:59:59.99999898672104+01:00
>> 			(class)@ -> DateAndTime
>> 
>> 			(oop)@   -> 324726017
>> 
>> 			offset@  -> 3600
>> 
>> 			seconds@ -> 4,5212759999999899E+08
>> 
>>  	but the comparing methods:  ( aDateAndTime{b} asDateAndTime between: start{c} and: self end {a} )
>> 
>> 	rightly, don't answer as i expect.
>> 
>> 
>> 
>> 	Considerations ?
>> 
>> 	Thanks,
>> 
>> 		Dario
>> _______________________________________________
>> Glass mailing list
>> Glass at lists.gemtalksystems.com
>> http://lists.gemtalksystems.com/mailman/listinfo/glass
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150625/83b7b62b/attachment-0001.html>


More information about the Glass mailing list