(the_time, tz=None)
| 29 | |
| 30 | # ms(int) or second(float) or str |
| 31 | def to_pd_timestamp(the_time, tz=None) -> pd.Timestamp | None: |
| 32 | if the_time is None: |
| 33 | return None |
| 34 | # treat int as milliseconds, e.g. return from js |
| 35 | if type(the_time) == int: |
| 36 | return pd.Timestamp.fromtimestamp(the_time / 1000) |
| 37 | |
| 38 | # treat float as seconds, e.g. return from |
| 39 | # timestamp_seconds = time.time() |
| 40 | if type(the_time) == float: |
| 41 | return pd.Timestamp.fromtimestamp(the_time) |
| 42 | |
| 43 | return pd.Timestamp(the_time, tz=tz) |
| 44 | |
| 45 | |
| 46 | def get_local_timezone(): |
no outgoing calls