Usenet comp.sys.dec (1990-2013)
 help / color / mirror / Atom feed
From: "Arne Vajhøj" <avajhoej@gtech.com>
To: Daniel Steinmetz <dani@transtech.net>, avajhoej@gtech.com
Subject: Re: Date Calculations in Dec Fortran
Date: 1999/03/01	[thread overview]
Message-ID: <36DAA9B8.5CD1185E@gtech.com> (raw)
In-Reply-To: 36DA2562.D3D02A6E@transtech.net

Daniel Steinmetz wrote:
> Does anyone have routines that manipulate dates and would not mind
> sharing them ? I'm interested in subtracting a certain number of days
> from todays date (format YYYYMMDD ) and getting the result in a similar
> format.

One solution is to use the C RTL like:

      integer*4 t2
      structure /tm/
        integer*4 tm_sec,tm_min,tm_hour,tm_mday,tm_mon,tm_year,
     +            tm_wday,tm_yday,tm_isdst
      endstructure
      record /tm/t
      integer*4 decc$mktime,decc$localtime
      t.tm_year=99
      t.tm_mon=2
      t.tm_mday=1
      t.tm_hour=0
      t.tm_min=0
      t.tm_sec=0
      t2 = decc$mktime(t)
      t2 = t2 - 67*(24*60*60)
      call lib$movc3(9*4,%val(decc$localtime(t2)),t)
      write(*,*) t.tm_year,t.tm_mon,t.tm_mday
      end

which surprisngly works fine on VMS Alpha 6.2 !

Arne



  parent reply	other threads:[~1999-03-01  5:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-03-01  5:00 Date Calculations in Dec Fortran Daniel Steinmetz
1999-03-01  5:00 ` Herman D. Knoble
1999-03-01  5:00 ` Arne Vajhøj [this message]
1999-03-02  5:00 ` Pierre.Bru
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox