-
January 27th, 2010, 09:27 PM
#1
How to convert a Julian date to regular date and time?
Like
2455224.7439457 = 01/28/2010 at 07:51:16,
I've do the google, for my first language is not English, so I may miss something,
It's even better if there's some pseudocode for the algorithm.
Actually I concern the time precision more!
Please do me a favor, give me some link,thanks in advance!
Last edited by fantasy1215; January 27th, 2010 at 09:48 PM.
-
January 27th, 2010, 10:50 PM
#2
Re: How to convert a Julian date to regular date and time?
A quick search of codeguru finds this post from 2001:
http://www.codeguru.com/forum/showthread.php?t=38906
two of the links are dead, but this one:
http://wwwmacho.mcmaster.ca/JAVA/JD.html
has included javascript that looks pretty straight forward:
Code:
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide script from old browsers
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
}
// end hiding script from old browsers -->
</SCRIPT>
-
January 27th, 2010, 10:57 PM
#3
Re: How to convert a Julian date to regular date and time?
-
January 28th, 2010, 12:57 AM
#4
Re: How to convert a Julian date to regular date and time?
First Thanks for your guys' reply.
hoxsiew 's reply is about converting regular date to Julian date.
And
Nikitozz 's reply http://mathforum.org/library/drmath/view/51907.html
This algorithm only supply converting Julian date to regular date, but no regular time,
I'd concern about converting Julian date to regular time too.
Please!
-
January 28th, 2010, 06:17 AM
#5
Re: How to convert a Julian date to regular date and time?
If you know the base of the julian date, you can easily convert the float value to a FILETIME structure. Then use the API functions to convert to anything you want.
FileTimeToSystemTime() would let you convert the FILETIME to a SYSTEMTIME which has the separate date/time components.
-
January 28th, 2010, 08:35 AM
#6
Re: How to convert a Julian date to regular date and time?
Originally Posted by fantasy1215
First Thanks for your guys' reply.
hoxsiew 's reply is about converting regular date to Julian date.
The code is very straightforward. I don't know anything about javascript and it seemed obvious to me. I assumed you could figure it out given all the clues in that snippit. If you want someone to write the whole thing for you, hire a freelancer.
-
January 28th, 2010, 08:51 AM
#7
Re: How to convert a Julian date to regular date and time?
Originally Posted by hoxsiew
The code is very straightforward. I don't know anything about javascript and it seemed obvious to me. I assumed you could figure it out given all the clues in that snippit. If you want someone to write the whole thing for you, hire a freelancer.
If you don't kown anything about javascript, it won't be a problem at all.
javascript is seeminly a compulsory part to make a complete beautiful website but js software are available out there for free, you need not worry about this.
Software engineering is about not to reinvent the wheel, we appreciate all library writers who contribute their efforts to making the code nicely. Reverse engineering works out in the same school of thoughts when people need to modify or improve already made "soft copies" !
Hmmm, If some javascript professional sits around listening to what I am talking, he will envy and get angry soon. But I am glad to be sure of his selfishness for the misconstruction simply over what people could do...
hi,,,
-
January 28th, 2010, 02:49 PM
#8
Re: How to convert a Julian date to regular date and time?
Originally Posted by Khiem
Hmmm, If some javascript professional sits around listening to what I am talking, he will envy and get angry soon.
Assuming he can actually understand what you're saying.
-
January 28th, 2010, 03:30 PM
#9
Re: How to convert a Julian date to regular date and time?
I just left it alone. I wasn't sure what he was saying, but it was hardly germane to the topic.
-
January 28th, 2010, 09:36 PM
#10
Re: How to convert a Julian date to regular date and time?
Originally Posted by OReubens
If you know the base of the julian date, you can easily convert the float value to a FILETIME structure. Then use the API functions to convert to anything you want.
FileTimeToSystemTime() would let you convert the FILETIME to a SYSTEMTIME which has the separate date/time components.
Hi guys, I really don't understand Julian date well, Will you be kind to show me converting from Julian time to regular time part?
-
January 29th, 2010, 05:08 AM
#11
Re: How to convert a Julian date to regular date and time?
A 'julian' date is simply a number that counts a number of days (or another timing base, some count seconds, or count milliseconds). And this counts starts at some moment in time.
If you know what the timing base is, and the starting point, you can easily convert from one julian system to another. FILETIME is a julian system counting 100ns intervals since 1 jan 1601.
Converting from your format to FILETIME should only be a matter of a multiply or divide and an add. I don't know what your julian system uses as interval or starting point, so can't provide any actual code.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|