Jump to content


- - - - -

Formula to convert ProIV Julian to calendar date


5 replies to this topic

#1 Guest_TRAHMA_*

Guest_TRAHMA_*
  • Guests

Posted 07 June 2006 - 03:08 PM

Hi,

Could someone let me know the formula Pro-IV uses for converting Julian date to Calendar date. I assume in Pro-IV 01/01/1800 is the equivalent to Julian date 00001.

Please help me .

Thanks a lot.

#2 andykay

andykay

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 204 posts
  • Gender:Male
  • Location:Cyberspace...looking for work

Posted 07 June 2006 - 04:20 PM

TRAHMA,

1/1/1800 is not equivilant to a Julian date of 000001.

Calendar Date 1/1/1800 = 2378497 Julian Date.

Julian Date 1 = 25/11/-4713 Calendar Date


I'm not sure how ProIV would do it (or why (w00t) ), but here is how Java scripts do the calculation:

function compute(form) {
var y = parseFloat(form.year.value)
var m = parseFloat(form.month.value)
var d = parseFloat(form.day.value)
var uh = parseFloat(form.uth.value)
var um = parseFloat(form.utm.value)
var us = parseFloat(form.uts.value)

var extra = 100.0*y + m - 190002.5
var rjd = 367.0*y
rjd -= Math.floor(7.0*(y+Math.floor((m+9.0)/12.0))/4.0)
rjd += Math.floor(275.0*m/9.0)
rjd += d
rjd += (uh + (um + us/60.0)/60.)/24.0
rjd += 1721013.5
rjd -= 0.5*extra/Math.abs(extra)
rjd += 0.5
form.result.value = rjd



HTH,

AK

Edited by andykay, 07 June 2006 - 04:20 PM.

THE LIGHT AT THE END OF THE TUNNEL IS THE HEADLAMP OF THE TRAIN THAT'S ABOUT TO HIT YOU!!!

#3 Brian Manners

Brian Manners

    Member

  • Members
  • PipPip
  • 46 posts
  • Gender:Male
  • Location:Melbourne

Posted 07 June 2006 - 10:51 PM

G'day TRAHMA,

When you do a CDATE on the PRO-IV internal date of 1, you will get the 1st Jan 1800. Each day then increments PRO-IV's internal counter by 1. So today it's been 75399 days since the counter started.

I would assume PRO-IV created this structure to allow easy date ordering within PRO-ISAM files when specifying dates as keys to tables etc.

The version of PRO-IV we're using (Version : 5.0000 1.0.9) has a maximum of 438291 or 31/12/2999

So watch out for that 3K bug !! :-"

Edited by Brian Manners, 07 June 2006 - 10:53 PM.

It's all good

#4 Yann Blondaux

Yann Blondaux

    Newbie

  • Members
  • Pip
  • 7 posts
  • Gender:Male
  • Location:Karlskrona, Sweden

Posted 08 June 2006 - 06:35 AM

When you do a CDATE on the PRO-IV internal date of 1, you will get the 1st Jan 1800. Each day then increments PRO-IV's internal counter by 1. So today it's been 75399 days since the counter started.

ProIV is really an old language (w00t)
Now the counters are incremented automatically but in the beginning of the 18' there were a whole range of old women sitting in a drugstore pushing on a huge handle to increment the CDATE counter.

(Sorry, I couldn't help it)

Edited by Yann Blondaux, 08 June 2006 - 06:39 AM.


#5 Chris Pepper

Chris Pepper

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 369 posts
  • Gender:Male
  • Location:United Kingdom

Posted 08 June 2006 - 06:54 AM

There's lots of base dates out there!

Unix has 1 June 1970,

Excel has 1 January 1990 (on the pc) and for some bizarre reason it has 1 January 1904 on the Mac!

(that reminds me of the time when ProIV had different base dates on the mainframe & other systems!).

#6 Richard Bassett

Richard Bassett

    ProIV Guru

  • Members
  • PipPipPipPipPip
  • 696 posts
  • Location:Rural France

Posted 08 June 2006 - 04:32 PM

See the "Trivia" section at the end of the Wikipedia entry for "Epoch"

OP, note ProIV does not support -ve date values <_<

BTW, if it's "genuine" Julian dates you're interested in and you're using Oracle then ISTR there is some useful "J" date format.

Edited by Richard Bassett, 08 June 2006 - 04:37 PM.

Nothing's as simple as you think



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users