[Glass] TimeStamp format

Dale Henrichs via Glass glass at lists.gemtalksystems.com
Tue Nov 25 10:15:16 PST 2014


Dario,

In order to control the format of Date printing you need to use
#asStringUsingFormat:. The format array for DD/MM/YYY is:

  #(1 2 3 $/ 1 1 $: true true false)

TimeStamp does not implement #asStringUsingFormat: but it should and it
should look like this:

asStringUsingFormat: anArray
  "Returns a String that expresses the receiver in the format defined by
anArray.
 Generates an error if anArray contains an incorrect formatting
specification.

 See the class documentation of Date for a complete description of the
 String-formatting specification Array."

  | strm |
  strm := WriteStream on: String new.
  strm
    nextPutAll: (self date asStringUsingFormat: anArray);
    space;
    nextPutAll: self time printString.
  ^ strm contents

I will be adding this method into the GLASS master branch shortly ... I've
submitted an issue for this[1] ...

Dale


[1] https://github.com/GsDevKit/GsDevKit/issues/48

On Tue, Nov 25, 2014 at 8:38 AM, Dario Trussardi via Glass <
glass at lists.gemtalksystems.com> wrote:

> I forgot:
>
>         I have a problem into GLASS 3.1.0.6.
>
> > Ciao,
> >
> >       i have a problem when i print  a TimeStamp
> >
> >       ( TimeStamp  fromString: '10-28-2014 11:11:11 am')
> report   ->              10/28/2014 11:11:11
> >
> >
> >       The system don't  report the     dd  mm  year    format as i need.
> >
> >       I setup the system with:
> >
> >       run
> >       | time |
> >       time:= TimeZone timeDifferenceHrs: 1 dstHrs: 1 atTimeHrs: 2
> >       fromDayNum: 95 toDayNum: 304 on:  #Sunday beginning: 1967
> >       stdPrintString: 'Germany Standard Time' dstPrintString: 'Germany
> Legal Time'.
> >       TimeZone for:#Germany put: time.
> >       TimeZone default: time
> >
> >
> >       DateTime now.    report         ->      25/11/2014 16:26:28  (
> it's right ).
> >
> >
> >       Into GLASS 2.4 the system report  TimeStamp  in the right format,
> >
> >        and i think don't did any other change - setup into it.
> >
> >
> >       Considerations?
> >
> >
> >       Thank,
> >
> >                       Dario
> > _______________________________________________
> > Glass mailing list
> > Glass at lists.gemtalksystems.com
> > http://lists.gemtalksystems.com/mailman/listinfo/glass
>
> _______________________________________________
> 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/20141125/dc48fcf5/attachment.html>


More information about the Glass mailing list