On Mon, Jun 20, 2022 at 12:04 PM Martin Kreuzer <[email protected]> wrote:
> This is the version I now use on my SONY Xperia Z3 Compact D5803
> running Android v4.4.4 (KitKat) ...
...
> tz=: {{
> NB. get Android date (e.g.: Mon Jun 20 10:50:01 AZOST 2022)
> ad=. shell 'date'
> NB. define Blank
> BL=. 32 { a.
> NB. get list of blanks in the date string
> lob=. ad = BL
> NB. get indices of those 5 blanks
> iob=. I. lob
> NB. calc index of tz start
> izs=. >: 3 { iob
> NB. calc index of tz end
> ize=. <: 4 { iob
> NB. calc tz string length
> tzl=. >: ize - izs
> NB. extract TZ string
> TZ=. (izs + i. tzl) { ad
> }}
You could simplify this to:
NB. android date example: Mon Jun 20 10:50:01 AZOST 2022
tz=: {{ 4 {:: cut shell 'date' }}
If you wanted something portable, you could also add an IFJA branch to
your earlier tz implementation.
I hope this helps,
--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm