| Paste number 73536: | python Julian Day and Modified Julian Day functions |
| Pasted by: | sbp |
| When: | 1 year, 2 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+1KQO |
| Channel: | #swhack |
| Paste contents: |
>>> import time >>> def jdn(): ... year, month, day = time.gmtime()[:3] ... a = (14 - month) // 12 ... y = year + 4800 - a ... m = month + (12 * a) - 3 ... p = day + (((153 * m) + 2) // 5) + (365 * y) ... q = (y // 4) - (y // 100) + (y // 400) - 32045 ... return p + q ... >>> jdn() 2454845 >>> def mjd(): ... return jdn() - 2400000.5 ... >>> mjd() 54844.5 >>>
Annotations for this paste:
| Annotation number 2: | Yo p, welcome to lisppaste. Your gregorian carreer has ended. |
| Pasted by: | [bjoern] |
| When: | 1 year, 2 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+1KQO/2 |
| Paste contents: |
no text.
| Annotation number 1: | Modified Julian Day Number, rather |
| Pasted by: | sbp |
| When: | 1 year, 2 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+1KQO/1 |
| Paste contents: |
>>> import math >>> def mjdn(): ... return int(math.floor(jdn() - 2400000.5)) ... >>> mjdn() 54844