Flask Moment


1. Basic Time Formatting

from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    now = moment.utcnow()
    return render_template('index.html', now=now)

2. Custom Time Zone

from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    now = moment.utcnow().tzinfo('US/Eastern')
    return render_template('index.html', now=now)

3. Time Interval Formatting

4. Relative Time Formatting

5. Conditional Time Formatting

6. Time Formatting with Year

7. Time Formatting with Date and Time

8. Time Formatting with Seconds

9. Time Formatting with Microseconds

10. Time Formatting with ISO 8601

11. Time Formatting with Unix Timestamp

12. Time Formatting with Timezone Name

13. Time Formatting with Timezone Offset

14. Time Formatting with Timezone Abbreviation

15. Time Formatting with Timezone Offset in Hours

16. Time Formatting with Timezone Offset in Minutes

17. Time Formatting with Timezone Offset in Seconds

18. Time Formatting with Timezone Offset in Milliseconds

19. Time Formatting with Timezone Offset in Microseconds

20. Time Formatting with Timezone Offset in Nanoseconds

21. Time Formatting with Timezone Offset in Fractional Seconds

22. Time Formatting with Timezone Offset in Canonical Form

23. Time Formatting with Timezone Offset in Brackets

24. Time Formatting with Timezone Offset in Fixed Offset Format

25. Time Formatting with Timezone Offset in ISO 8601 Format

26. Time Formatting with Timezone Offset in RFC 822 Format

27. Time Formatting with Timezone Offset in RFC 1123 Format

28. Time Formatting with Timezone Offset in RFC 2822 Format

29. Time Formatting with Timezone Offset in RSS Format

30. Time Formatting with Timezone Offset in W3C Format

31. Time Formatting with Timezone Offset in ISO 8601 Extended Format

32. Time Formatting with Timezone Offset in ISO 8601 Basic Format

33. Time Formatting with Timezone Offset in POSIX Format

34. Time Formatting with Timezone Offset in Z Format

35. Time Formatting with Timezone Offset in +/- Format

36. Time Formatting with Timezone Offset in HH:MM Format