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
┌────┬──┬──┬──┬──┬─────┐
│2008│01│01│21│39│5.343│
└────┴──┴──┴──┴──┴─────┘
#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