Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

$HORO to date...

15 views
Skip to first unread message

Ralf Huwald

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
Hi!

I am searching a program zo convert $horo into a "readable" date (ie.
dd.mm.jjjj, jjjjmmdd, ...) and backwards.
Anybody out there, who can help me?!?

Thanks, Ralf

mailto ralf....@mosecker.de


Dmitri Martynoff

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
Hello, Ralf!
Ralf Huwald wrote in message <7oc4qb$iij$1...@news01.btx.dtag.de>...

>I am searching a program zo convert $horo into a "readable" date (ie.
>dd.mm.jjjj, jjjjmmdd, ...) and backwards.
>Anybody out there, who can help me?!?


In Cache' you may simply use $ZD() and $ZDT() functions.
Dmitri Martynov


Jürgen Kindler

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
Ray Newman wrote:
> The following is from MUMPS V1 and seems to work.
> %D ;Convert %D to printable date
> S:$D(%D)#2=0 %D=+$H S %D=$$D(%D) Q
> D(D,M,Y,ZR) S ZR="D^%D" I D<1!(D>423316) Q ""
> S:D>21608 D=D+1
> S M=1,Y=D\1461*4+1841,D=D#1461 F %=1:1:3 Q:D<366 S Y=Y+1,D=D-365
> F %=31,28+(Y#4=0),31,30,31,30,31,31,30,31,30,31 Q:D'>% S M=M+1,D=D-%
> S M=$P("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",",",M)
> Q $TR($J(D,2)," ",0)_" "_M_" "_Y

Seems - but after a few tests it could reveal that it does find too
many leap years...
Oh, I must be wrong - it uses the variable % - that's system programming!
Can't be wrong! >%->

SHD has a (documented) routine that works; with freely configureable
output formats and about 8 input formats including things like day of
year, month, _correct_ week of year , automatic completion of any valid
input format etc.
Unfortunately I'm not with SHD any more and have no access to it...
But maybe they'll give it away, if you ask someone there. :-)

--
Jürgen

--------------------------------------------------
"You'd have to be a born fool to be a king." (Granny Weatherwax)

lver...@nospam.nwu.edu

unread,
Aug 5, 1999, 3:00:00 AM8/5/99
to
Suddenly, Ray Newman (ray...@one.com.au) says...

> The following is from MUMPS V1 and seems to work.
>
> %D ;Convert %D to printable date
> S:$D(%D)#2=0 %D=+$H S %D=$$D(%D) Q
> D(D,M,Y,ZR) S ZR="D^%D" I D<1!(D>423316) Q ""
> S:D>21608 D=D+1
> S M=1,Y=D\1461*4+1841,D=D#1461 F %=1:1:3 Q:D<366 S Y=Y+1,D=D-365
> F %=31,28+(Y#4=0),31,30,31,30,31,31,30,31,30,31 Q:D'>% S M=M+1,D=D-%
> S M=$P("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",",",M)
> Q $TR($J(D,2)," ",0)_" "_M_" "_Y
>
> Ray Newman

I have discovered that the code above has a bug. Please examine the test
that I did on my system at work:

>W $ZV
Open M [ISM] for OpenVMS V7.x (Alpha) 6.4-F.14 (build-03) 20-JUL-1998
12:32:39.66
>

>F I=1:1:57925 S X=$$DTS^LMVDT(I),Y=$$UPPER^%ZLIBSTR($$D^%D(I)) I
X'=Y W !,X,?20,Y,?40,I

31 DEC 1844 00 JAN 1845 1461
31 DEC 1848 00 JAN 1849 2922
31 DEC 1852 00 JAN 1853 4383
31 DEC 1856 00 JAN 1857 5844
31 DEC 1860 00 JAN 1861 7305
31 DEC 1864 00 JAN 1865 8766
31 DEC 1868 00 JAN 1869 10227
31 DEC 1872 00 JAN 1873 11688
31 DEC 1876 00 JAN 1877 13149
31 DEC 1880 00 JAN 1881 14610
31 DEC 1884 00 JAN 1885 16071
31 DEC 1888 00 JAN 1889 17532
31 DEC 1892 00 JAN 1893 18993
31 DEC 1896 00 JAN 1897 20454
31 DEC 1900 00 JAN 1901 21914
31 DEC 1904 00 JAN 1905 23375
31 DEC 1908 00 JAN 1909 24836
31 DEC 1912 00 JAN 1913 26297
31 DEC 1916 00 JAN 1917 27758
31 DEC 1920 00 JAN 1921 29219
31 DEC 1924 00 JAN 1925 30680
31 DEC 1928 00 JAN 1929 32141
31 DEC 1932 00 JAN 1933 33602
31 DEC 1936 00 JAN 1937 35063
31 DEC 1940 00 JAN 1941 36524
31 DEC 1944 00 JAN 1945 37985
31 DEC 1948 00 JAN 1949 39446
31 DEC 1952 00 JAN 1953 40907
31 DEC 1956 00 JAN 1957 42368
31 DEC 1960 00 JAN 1961 43829
31 DEC 1964 00 JAN 1965 45290
31 DEC 1968 00 JAN 1969 46751
31 DEC 1972 00 JAN 1973 48212
31 DEC 1976 00 JAN 1977 49673
31 DEC 1980 00 JAN 1981 51134
31 DEC 1984 00 JAN 1985 52595
31 DEC 1988 00 JAN 1989 54056
31 DEC 1992 00 JAN 1993 55517
31 DEC 1996 00 JAN 1997 56978
>

The first column is from a date program we use on the system that I made
a quick modification to so that the date would output in the same format
as %D. The second column is the output from %D. The third column is the
$H date that the two programs used.

---------------------------------
"Friends help you move. Real friends help you move bodies."
Leane Verhulst
Spam Block: Replace nospam with nmff

Ray Newman

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
Ralf Huwald wrote:
>
> Hi!

>
> I am searching a program zo convert $horo into a "readable" date (ie.
> dd.mm.jjjj, jjjjmmdd, ...) and backwards.
> Anybody out there, who can help me?!?
>
> Thanks, Ralf
>
> mailto ralf....@mosecker.de

Ray Newman

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
lver...@nospam.nwu.edu wrote:
>
> Suddenly, Ray Newman (ray...@one.com.au) says...
> > The following is from MUMPS V1 and seems to work.
> >
> > %D ;Convert %D to printable date
> > S:$D(%D)#2=0 %D=+$H S %D=$$D(%D) Q
> > D(D,M,Y,ZR) S ZR="D^%D" I D<1!(D>423316) Q ""
> > S:D>21608 D=D+1
> > S M=1,Y=D\1461*4+1841,D=D#1461 F %=1:1:3 Q:D<366 S Y=Y+1,D=D-365
> > F %=31,28+(Y#4=0),31,30,31,30,31,31,30,31,30,31 Q:D'>% S M=M+1,D=D-%
> > S M=$P("Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",",",M)
> > Q $TR($J(D,2)," ",0)_" "_M_" "_Y
> >
> > Ray Newman
>
> I have discovered that the code above has a bug. Please examine the test
> that I did on my system at work:
>
> >W $ZV
> Open M [ISM] for OpenVMS V7.x (Alpha) 6.4-F.14 (build-03) 20-JUL-1998
> 12:32:39.66
> >
>
> >F I=1:1:57925 S X=$$DTS^LMVDT(I),Y=$$UPPER^%ZLIBSTR($$D^%D(I)) I
> X'=Y W !,X,?20,Y,?40,I
>
> 31 DEC 1844 00 JAN 1845 1461
> 31 DEC 1848 00 JAN 1849 2922
><SNIP>

Quite right, adding S:'D D=1461,Y=Y-4 after the D=D#1461 will fix it.

Ray Newman

BTW If anyone wants a comprehensive date formatter, I have one I am
prepared to post.

jncha...@my-deja.com

unread,
Aug 6, 1999, 3:00:00 AM8/6/99
to
In article <7oc4qb$iij$1...@news01.btx.dtag.de>,

"Ralf Huwald" <ralf....@mosecker.de> wrote:
> Hi!
>
> I am searching a program zo convert $horo into a "readable" date (ie.
> dd.mm.jjjj, jjjjmmdd, ...) and backwards.
> Anybody out there, who can help me?!?
>
> Thanks, Ralf
>
> mailto ralf....@mosecker.de
>
> In DSM you can perform the following.

>S %H=$P($H,","),2) S X=$ZD(%H,2) or

S %H=$P($H,",") S X=$&ZLIB.%CDATASC(%H,2) for a 2 digit year or

S %H=$P($H,",") S X=$&ZLIB.%CDATASC(%H,3) for a 4 digit year.


Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

Kate Schell

unread,
Aug 9, 1999, 3:00:00 AM8/9/99
to
Dmitri Martynoff wrote:

> Hello, Ralf!
> Ralf Huwald wrote in message <7oc4qb$iij$1...@news01.btx.dtag.de>...

> >I am searching a program zo convert $horo into a "readable" date (ie.
> >dd.mm.jjjj, jjjjmmdd, ...) and backwards.
> >Anybody out there, who can help me?!?
>

> In Cache' you may simply use $ZD() and $ZDT() functions.
> Dmitri Martynov

Be very, VERY careful using $ZD & $ZDT; the results of these functions can
change depending on the settings of system switches. I don't use other
people's functions if I can't guarantee the results...

--
======================================================================
Kate Schell csc...@JacquardSystems.com
Jacquard Systems Research phone & fax: 301-762-8999
800 Nelson Street http://www.JacquardSystems.com
Rockville, MD 20850-2051
Old code never dies.
It just hangs around waiting for the millennium.
======================================================================

Jean Durka

unread,
Aug 23, 1999, 3:00:00 AM8/23/99
to
Is there a way to set system switches to produce date format mm/dd/yyyy for
any century using $ZD and $ZDT

Rod Dorman

unread,
Aug 24, 1999, 3:00:00 AM8/24/99
to
In article <37C18862...@salud.unm.edu>,

Jean Durka <gdu...@salud.unm.edu> wrote:
>Is there a way to set system switches to produce date format mm/dd/yyyy for
>any century using $ZD and $ZDT

Since by definition $Z functions are non Standard that would depend on
the specific implementation you're running on.
--
-- Rod --
ro...@polylogics.com

Dmitri Martynoff

unread,
Aug 30, 1999, 3:00:00 AM8/30/99
to
Hello, All!
Jean Durka wrote in message <37C18862...@salud.unm.edu>...

>Is there a way to set system switches to produce date format mm/dd/yyyy for
>any century using $ZD and $ZDT


In Cache', set the 4th parameter of $ZD() or the 6th parameter of $ZDT()
(yearopt) to 4.
Dmitri A. Martynov,
Makova AG (http://www.makova.com)


Valentin Kamburov

unread,
Aug 31, 1999, 3:00:00 AM8/31/99
to
In article <7oc4qb$iij$1...@news01.btx.dtag.de>,
"Ralf Huwald" <ralf....@mosecker.de> wrote:
> Hi!
>
> I am searching a program zo convert $horo into a "readable" date (ie.
> dd.mm.jjjj, jjjjmmdd, ...) and backwards.
> Anybody out there, who can help me?!?
>
> Thanks, Ralf
>
> mailto ralf....@mosecker.de
>
> Hello Ralf !
In Micronetic's MSM I am using function $ZHL and program ^%DI
Try following:
W $ZHL(1,"dd.mm.yyyy") will write currently $H into specified format.
W $ZHL(1,"d.m.yyyy",58133) will write 29.2.2000
W $$CONVERT^%DI("29.2.2000","d.m.yyyy") will write 58133
Best regards !
Valentin

--
Valentin Kamburov
Project/Analyst Engineer
TranSoft a.s.
Ceske Budejovice,Czech Republi

0 new messages