# Get date and time by position of the sun and the observer position

I am working on an astrology project (don't panic, my question is about astronomy or math), where I need to figure out some values by the longnitude of the planets.

I have a program for this, the Swiss ephemeris.

With this, I can get the position of the planets by the time and the geolocation of the observer.

What I need to do is to do it backward, so I need to get the exact date and time by the given position of the sun and the position of the observer.

For example, today (2015.12.16 00:00:00 UT) the longitude of the sun is 263.6893755 from postion (lng,lat,alt) 19.2,47.29,0 on Earth.

I need a formula, what tells me, what was the UT time from this longitude of sun -88 degree.

Can anybody give me a clue, how can I calculate this?

I made some research of course on the net, and I found the related wiki article, but if I am honest, there are too many unknown terms and phrase here, what I really do not understand, and I do not want to dig in too deep.

• Maybe this will be the answer, somebody asked exact the same thing: physics.stackexchange.com/questions/25336/… I will tell you if it is. – vaso123 Dec 16 '15 at 11:16
• No, it does not helped. First of all, the delta is not precise enough, and I want to know the date, but delta need the date. – vaso123 Dec 17 '15 at 9:37

I think you can very easily use the transformations available in the wiki link to obtain the Julian day, then exploit the position of observer to get local sidereal time. Lets start by computing the Julian day you have a given longitude $L$ which gives you $n$ number of days since Greenwich noon as
$$n = \dfrac{L-280.4860}{0.9856474}$$ giving the corresponding Julian day as
$$JD = n+2451545$$ once you have Julian day you can use the following link to obtain UT
http://ssd.jpl.nasa.gov/tc.cgi

• Thank you for this answer, but before this, I found the solution, and this is bad because: you want to know the exact date, and this need the n, what I do not know. And this is not good, because I've checked, and the angle is not the same in every year 1st day. I think, because of the leap year. – vaso123 Dec 22 '15 at 12:34
• @lolka_bolka for $n$ you only need the longitude of the sun, which you mentioned in the question. Yes, the angle is not the same each year which is why for astronomical computations you have the concept of Julian day, which is continuous increment in days since 4713 BC Jan 1, removing the concept of leap year. If I understood your question correctly this should have been enough – Astroynamicist Dec 22 '15 at 13:44

Ok guys, I've found the solution. Sadly, if you really want to know the really exact datetime, there is no exact and universal formula.

I found several formulas:

https://physics.stackexchange.com/questions/25336/reverse-sun-position-algorithm

http://www.pveducation.org/pvcdrom/properties-of-sunlight/declination-angle

http://www.itacanet.org/the-sun-as-a-source-of-energy/part-3-calculating-solar-angles/

There are several problem with these formulas.

What I'd like to know?

As I mentioned in my original post, I have a datetime, and a geolocation, and with that Swiss ephemeris program, I can "query" the angle of the sun.

From this point, I substract 88 degree with this angle, and I want to know the exact date time by the angle and the geolocation.

The problems

The first problem is the declination. There are several problems with this. The declination is not the same at every day in a year as you know. Ok, let's say, I want to figure it out. I can not. Since, I want to know the exact date first, I do not know, the ordinal date. Sigh, at this point the whole formula has a missing value. But, let's assume, I know. Even, if I know the ordinal date, the formula is not right, because the declination is not the same at 2015-01-01 and 2016-01-01. Let's see:

swetest.exe -edirD:/Apache/htdocs/astro/vendors/swiss/ -b01.01.2010 -geopos19.2,47.29,0 -topo  -p0 -eswe -fPlTd -g, -head -n5 -s365.4
Sun            , 280.4507684,01.01.2010,-23.0283899
Sun            , 280.6104798,01.01.2011 9:36:00 ET,-23.0160751
Sun            , 280.7713793,01.01.2012 19:12:00 ET,-23.0008866
Sun            , 280.9345061,01.01.2013 4:48:00 ET,-22.9876598
Sun            , 281.0890407,01.01.2014 14:24:00 ET,-22.9741190


-22...., -23... is the declination. Declination is the same in a day.

So these formulas can gives you approximate results, but not the exact, even if you know the ordinal date. And I think, the formula is does not calculate with the leap years.

The solution

In my case, the solution was to track back 95 days, and get 20 recors for every day from that time. 95 because the sun is moving 1 degree about 1 day and 2-3 hours. The sun has different speed at different dates, 95days seems enought for me for 88 degree.

With my program, I am checking, where the integer values are equals. For example, if I need to get 69.217465 degree I am just checking, where the sun was in 69.xxxxx position.

When I have this date, I am track back 3 days, and list the values by hours, 72 hours. I get the proximate date and time. And after this, I track back 3 hours, and listing the results by seconds.

This will be the exact (most proximate) date and time.

From a Yahoo group, a guy told me, this is an interpolation. This is how you can get the exact date time for a given angle, I do not know more precise method. If you know, please write me.

• Your algorithm is right but you can use sun's speed (option "s") to calculate time. In my case i found exactly date and time which is corresponding with 88 sun degree with only two steps. – Hokku San Oct 9 '17 at 9:31
• Could you please explain method do determine birth's date timezone? – Hokku San Oct 9 '17 at 9:34
• I am using UTC everywhere, and later convert it by programming language and not use -geopos19.2,47.29,0 -topo – vaso123 Nov 4 '17 at 9:51