Silverfrost Forums

Welcome to our forums

problem with convdate@

19 Oct 2012 5:41 #10862

I asked in a general post if someone could tell me what the initial date for SECS is in CONVDATE@. I found online (http://www.silverfrost.com/ftn95-help/time/h_convdatea.aspx) that SECS should be the number of seconds since the beginning of 1970.

But I can't get the following simple test code to run -- it gives 'date out of range''. Can someone please tell me where I'm going wrong?

  program test_time_in_nanoseconds_to_date

  integer (kind=3) n_secs
  
  integer (kind=2) n_DoW, n_Day, n_Month, n_Year

  itt = 6

  n_secs = 100

  call Convdate@ ( n_secs, n_DoW, n_Day, n_Month, n_Year )

  write ( itt, '(/ 4i10 )' ) n_secs, n_DoW, n_Day, n_Month, n_Year

  n_secs = 10 * 24 * 60 * 60

  call Convdate@ ( n_secs, n_DoW, n_Day, n_Month, n_Year )

  write ( itt, '(/ 4i10 )' ) n_secs, n_DoW, n_Day, n_Month, n_Year
  
  stop
  end
19 Oct 2012 7:45 #10863

There is an internal comment that says...

'Days since 1/1/1970 (only works after 29th Feb 1972)'

so you will need to use a suitably large value for n_secs.

n_secs = 10365246060

gives a result that looks about right.

19 Oct 2012 8:01 #10864

Thanks, Paul

I'm really glad now that I posted a query, rather than stuffing around thinking that the problem was at my end.

Please login to reply.