How can I format the output of localtime?
Sometimes, i get the result "2012-08-05 21:05:33.000006" with the command "ephem.
The result of the code is:
conte@scheidewe
Sonnenaufgang: 2012-08-06 06:08:26 Lokale Zeit
Sonnenuntergang: 2012-08-05 21:05:33.000006 Lokale Zeit
conte@scheidewe
Example code:
#!/usr/
import ephem
import math
home = ephem.Observer()
home.long = "7.29965"
home.lat ="51.13820"
home.elevation = 308
home.date = ephem.now()
hza = math.acos(
home.horizon = hza
sun = ephem.Sun()
sunrise = home.next_
sunset = home.next_
print "Sonnenaufgang: ", ephem.localtime
print "Sonnenuntergang: ", ephem.localtime
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- PyEphem Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- Brandon Rhodes
- Solved:
- Last query:
- Last reply: