Hi,
what is the best way to print times and dates in a custom format? For example I want to print times like "hh:mm" or "hh-mm 'o clock". I looked at TimestampPrintPolicy but could not get the desired results. Btw, the method PrintPolicy>>printShort:on: requires a stream as first argument and the object as second. Personally I've got the feeling, that the selecter suggests it to be vice versa as in PrintPolicy>>printLong:on: Ciao, Steffen _______________________________________________________________________ Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220 _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
TimestampPrintPolicy can do the work.
(TimestampPrintPolicy print: Time now using: 'hh-mm') , ' ''o clock' --- Alex Baran 2008/10/24 Steffen Märcker <[hidden email]> Hi, _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Steffen Märcker
Steffen
If you look more closely at TimestampPrintPolicy you will see you can create your own policy of format tokens. Look at TimestampPrintPolicy class>>nextTokenOn: and TimestampPrintPolicy>>print:on:using: and study their usage. Terry =========================================================== Terry Raymond Crafted Smalltalk 80 Lazywood Ln. Tiverton, RI 02878 (401) 624-4517 [hidden email] <http://www.craftedsmalltalk.com> =========================================================== > -----Original Message----- > From: [hidden email] [mailto:[hidden email]] On Behalf Of Steffen Märcker > Sent: Friday, October 24, 2008 8:50 AM > To: [hidden email] > Subject: [vwnc] formatted print of time and date > > Hi, > > what is the best way to print times and dates in a custom format? For example I want to print times > like "hh:mm" or "hh-mm 'o clock". I looked at TimestampPrintPolicy but could not get the desired > results. > > Btw, the method PrintPolicy>>printShort:on: requires a stream as first argument and the object as > second. Personally I've got the feeling, that the selecter suggests it to be vice versa as in > PrintPolicy>>printLong:on: > > Ciao, Steffen > _______________________________________________________________________ > Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage > kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220 > > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Steffen Märcker
I just did a "Smalltalk Daily" on this - see the 2nd and 3rd ones here:
http://www.cincomsmalltalk.com/userblogs/cincom/blogView?content=smalltalk_daily_libraries James Robertson Cincom Smalltalk Product Evangelist http://www.cincomsmalltalk.com/blog/blogView Talk Small and Carry a Big Class Library On Oct 24, 2008, at 8:50 AM, Steffen Märcker wrote: > Hi, > > what is the best way to print times and dates in a custom format? > For example I want to print times like "hh:mm" or "hh-mm 'o clock". > I looked at TimestampPrintPolicy but could not get the desired > results. > > Btw, the method PrintPolicy>>printShort:on: requires a stream as > first argument and the object as second. Personally I've got the > feeling, that the selecter suggests it to be vice versa as in > PrintPolicy>>printLong:on: > > Ciao, Steffen > _______________________________________________________________________ > Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 30 Tage > kostenlos testen. http://www.pc-sicherheit.web.de/startseite/? > mc=022220 > > > _______________________________________________ > vwnc mailing list > [hidden email] > http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |