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

use astropy.time

parent 3570fb46
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -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")