repl.it
@tml/

SimplisticModernParser-1

Python

No description

fork
loading
Files
  • main.py
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import pendulum
from pendulum.tz.timezone import Timezone

now = pendulum.now()

###############################################################
def date_delta(date_in):
    from_now = date_in.diff(now).in_words()
    return(from_now, "ago" if date_in.is_past() else "remaining")

raw_date = pendulum.parse('2019-01-10T00:20:00+00:00')

(from_now, event_delta) = date_delta(raw_date)

print(from_now, event_delta)
print(raw_date.format('MMM, D, YYYY HH:mm:ss'))
print(raw_date.in_tz('Europe/Paris').format('MMM, D, YYYY HH:mm:ss'))
print(raw_date.in_tz('America/Denver').format('MMM, D, YYYY HH:mm:ss'))