ISO timestamp should be produced simpler with printf. However, it does not honor zero padding properly.
'%04d-%02d-%02dT%02d:%02d:%02d'printf 6!:0'' 2008- 1-20T19:18: 8 So you resort to a cumbersome workaround: '%4.4d-%2.2d-%2.2dT%2.2d:%2.2d:%2.2d'printf 6!:0'' 2008-01-20T19:17:30 It was reported earlier, but nothing has been done since then; it was not even acknowledged. So a bug is filed this time. http://www.jsoftware.com/jwiki/System/Library/Bugs#printf --- Tom Arneson <[EMAIL PROTECTED]> wrote: > Try isotimestamp. It formats the result of 6!:0 to a fixed format > > load'dates' > isotimestamp 6!:0'' > 2008-01-20 16:09:33.421 > > > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Matthew Brand > Sent: Sunday, January 20, 2008 15:39 > To: [email protected] > Subject: [Jprogramming] 6!:0 timestamps in January > > The phrases page for dates states that m0=: 6!:0 gives > the system time stamp in the format "yyyy mm dd hh mm > ss". But for January it gives "yyyy m dd hh mm ss" and > some of the phrases for dealing with time stamps on > the phrases page do not work correctly. > > E.g. this does not function correctly in January: > m0 =. 6!:0 > m3=: (':'"_) _6 _3} ": > m3 m0'' > 2008 1 20 21 1:3.:53 > > In that code, replacing ": with something more > complicated might fix this. > > This is how far I can get with that: > > Suppose that the timestamp is: 2008 1 1 21 39 5.343 > then: > > ts =. 2008 1 1 21 39 5.343 > ts > 2008 1 1 21 39 5.343 > old =. ": > old ts > 2008 1 1 21 39 5.343 > #old ts > 20 > > has the problem that string length depends on what the > month and day is (months 1 and 2 and days 1 to 9 are > problems). > > Replacing the ": with this something like this (but > opened): > new =. [: ((]`([:'0'&,]))@.(1:=#)@":&.>) [: <"(0) ] > > new ts > ¡¦¦ > ;¦¦¦Á > 2;¢ > 2008 01 01 21 39 5.343 > ¤¨¨ > ;¨¨¨Á > 2;£ > #new ts > 6 > #&.> new ts > ¡¦¦¦¦¦ > ;¢ > 4 2 2 2 2 5 > ¤¨¨¨¨¨ > ;£ > > would circumvent this problem and make the phrases > work in January and on days before the 10th, but I > cannot work out how to concatenate all of the contents > of the boxes into a single string without the padding. > > E.g. if I do ,> new ts then it adds padding: > ,> new ts > 2008 01 01 21 39 5.343 > # ,> new ts > 30 > > How can I concatenate all of the strings in the boxes > without adding the padding? I want to get a string of > length: > > +/> #&.> new ts > 17 > > If I could get that to work then I would replace > phrases like: > m3=: (':'"_) _6 _3} ": > > with > m3=: (':'"_) _6 _3} new > > and hopefully they would function correctly for all > possible values of 6!:0. > > > > __________________________________________________________ > Sent from Yahoo! Mail - a smarter inbox http://uk.mail.yahoo.com > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ____________________________________________________________________________________ Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
