Commit 5ad5dfe7 authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

use astropy.time

parent 3570fb46
Pipeline #2584 failed with stage
in 0 seconds
......@@ -7,15 +7,21 @@ Created: 2023-03-09
Modified-History:
2023-03-09, Bo Zhang, created
2023-03-09, Bo Zhang, add two time formats
2023-12-20, Bo Zhang, use astropy.time
"""
import datetime
from astropy import time
def now():
"""Return ISOT8601 format datetime, for time stamps in data products."""
return datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")
"""Return ISOT format datetime using `astropy`."""
return time.Time.now().isot
def now_dfs():
"""Return ISOT8601 format datetime, for DFS usage only."""
return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
# def now():
# """Return ISOT8601 format datetime, for time stamps in data products."""
# return datetime.datetime.now().strftime("%Y-%m-%dT%H:%M:%S.%f")
# def now_dfs():
# """Return ISOT8601 format datetime, for DFS usage only."""
# return datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment