ptyrad.utils.time#
Get time from datetime and parse time to string
Functions
|
Returns a formatted timestamp string based on time_format. |
|
- ptyrad.utils.time.get_time(time_format='date')[source]#
Returns a formatted timestamp string based on time_format.
- Parameters:
time_format (bool or str) – Controls the time formatting behavior. - True: Use default date format (“%Y%m%d”). - False, None, or “”: Disable timestamp and return an empty string. - “date”: Use date format (“%Y%m%d”). - “datetime”: Use date and time format (“%Y%m%d_%H%M%S”). - “time”: Use time-only format (“%H%M%S”). - Custom strftime format (e.g., “%Y-%m-%d %H:%M”) is also supported.
- Returns:
Formatted timestamp string, or an empty string if disabled.
- Return type:
str