Skip to content

convert longitude to date #306

Answered by cosinekitty
arumdyaharum asked this question in Q&A
Discussion options

You must be logged in to vote

OK, that explanation helps. I recommend calling SunPosition to find the Sun's longitude at the birth date. It returns type EclipticCoordinates, which contains the Sun's ecliptic longitude in the variable elon.

Once you have that, subtract 88 degrees, and pass the result to SearchSunLongitude. The resulting code could look something like this:

const birth = Astronomy.MakeTime(new Date('2023-06-12T00:00:00Z'));
const sun = Astronomy.SunPosition(birth);
const target = ((sun.elon - 88) + 360) % 360;
const design = Astronomy.SearchSunLongitude(target, birth.AddDays(-100), 100);
console.log(design.date);    //  2023-03-13T16:03:31.528Z

Replies: 3 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@arumdyaharum
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by arumdyaharum
Comment options

You must be logged in to vote
1 reply
@cosinekitty
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants