Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Validating a custom date against a calendar
#11
well, in perl i do something like this to validate dates:

Code:
$jd = julian ($day, $month, $year);
($nday, $nmonth, $nyear) = gregorian($jd)

'pseudocode for understanding sakes:

if (
     $nday = $day AND
     $nmonth = $month AND
     $nyear = $year
   ) {
     $isvalid = "VALID"
  }

to increase a day:

Code:
$jd = julian ($day, $month, $year);
$jd = $jd + 1;
($day, $month, $year) = gregorian($jd);

and to find the day of the week:

Code:
$jd = julian ($day, $month, $year);
$dayofweek = $jd MOD 7

of course, i substituted some of that with qbasic code but it should be easier to get. The julian day number, which most formulas are accurrate up to about the next 100 years, is what's called a serial date, the counting of days from a particular date. It's very useful for date math.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#12
I think someone has redefined the meaning of "julian date". Before the Y2K issue, julian dates were: YYNNN where YY was the year and NNN was the number of days in the year. Example: 03001 would be 01-Jan-03 and 03365 would be 31-Dec-03. This was a standard for decades, and as a matter of fact, IBM standard header labels for files contained this dates in this format.

Now what you guys are saying is that in some language (like the sample code above) they have redefined julian date to be the total number of days of a given date, probably a number of total days after some arbitrarily chosen date in the past, probably 15xx when Gregorian dates began. I've seen a language (PICKBasic) that starts these total days in 1967 for convenience of keeping the number small. For lack of a better term, I always referred to these total days as a "date factor".

However, I can't believe that this total days after some date has yet become an industry standard for the term "julian date". I'll look into this further.
*****
Reply
#13
Moneo, that julian date has nothing to do with the language, is an older concept:

http://tycho.usno.navy.mil/mjd.html

It has been in use by astronomes and mathematicians for centuries.
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#14
The julian day number isnt the julian calendar created by caesar. Moneo's confused because you used "julian date", which *is* what he's talking about. The julian day number was established in the 16th century, named after the guy that invented it, and that's the official title for it. There is a modern Julian day number that ticks from sometime in the 1850s, but you still have to calculate the big one to get it so there's no point.

Here's a good link on the subject:
Julian Day Numbers
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#15
TOONSKI,
Thanks for backing me up. According to the article for which you provided the link, my definition of julian date is the same as what NASA uses --- not as "old" as Nathan claims". :bounce:
*****
Reply
#16
Yeah, but the official definition of it, as it's been used for hundreds of years, is a counting of days from ancient times. And this is getting off track. You can use any serial (day count) date to validate a date and do math with it, but the Julian Day Number (in its official form) is the most popular format.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#17
That is what I meant. Sorry for being wrong :x
SCUMM (the band) on Myspace!
ComputerEmuzone Games Studio
underBASIC, homegrown musicians
[img]http://www.ojodepez-fanzine.net/almacen/yoghourtslover.png[/i
Reply
#18
Quote:.... but the Julian Day Number (in its official
form) is the most popular format.
That's interesting. Where can I read about this "official form"?
*****
Reply
#19
erm... at the link. the julian day number was made up in the 1500s as a count since the first day of the julian period. It's been that way for hundreds of years.
i]"I know what you're thinking. Did he fire six shots or only five? Well, to tell you the truth, in all this excitement, I've kinda lost track myself. But being as this is a .44 Magnum ... you've got to ask yourself one question: 'Do I feel lucky?' Well, do ya punk?"[/i] - Dirty Harry
Reply
#20
Ok, Toonski, I looked at the site again. But I can't see what makes their definition of julian days *official*. It doesn't even say who these people are.

This reminds me of all the algorithms for calculating the Easter Sunday. More than half of the algorithms I saw on websites don't work 100%, if at all. I haven't found an "official" one yet. I consider the one I use as good because it was written by Donald Knuth of Stanford University. The above experts on julian days don't even sign their name.
*****
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)