# Flask Moment

***

**1. Basic Time Formatting**

```python
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**

```python
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**

```python
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    start = moment('2020-10-01')
    end = moment('2020-10-10')
    interval = end - start
    return render_template('index.html', interval=interval)
```

**4. Relative Time Formatting**

```python
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    now = moment.utcnow()
    last_week = now - timedelta(days=7)
    return render_template('index.html', now=now, last_week=last_week)
```

**5. Conditional Time Formatting**

```python
from flask import Flask, render_template

app = Flask(__name__)

@app.route('/')
def index():
    now = moment.utcnow()
    if now.hour < 12:
        message = 'Good morning'
    else:
        message = 'Good evening'
    return render_template('index.html', now=now, message=message)
```

**6. Time Formatting with Year**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**7. Time Formatting with Date and Time**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**8. Time Formatting with Seconds**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**9. Time Formatting with Microseconds**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**10. Time Formatting with ISO 8601**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**11. Time Formatting with Unix Timestamp**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**12. Time Formatting with Timezone Name**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**13. Time Formatting with Timezone Offset**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**14. Time Formatting with Timezone Abbreviation**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**15. Time Formatting with Timezone Offset in Hours**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**16. Time Formatting with Timezone Offset in Minutes**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**17. Time Formatting with Timezone Offset in Seconds**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**18. Time Formatting with Timezone Offset in Milliseconds**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**19. Time Formatting with Timezone Offset in Microseconds**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**20. Time Formatting with Timezone Offset in Nanoseconds**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**21. Time Formatting with Timezone Offset in Fractional Seconds**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**22. Time Formatting with Timezone Offset in Canonical Form**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**23. Time Formatting with Timezone Offset in Brackets**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**24. Time Formatting with Timezone Offset in Fixed Offset Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**25. Time Formatting with Timezone Offset in ISO 8601 Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**26. Time Formatting with Timezone Offset in RFC 822 Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**27. Time Formatting with Timezone Offset in RFC 1123 Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**28. Time Formatting with Timezone Offset in RFC 2822 Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**29. Time Formatting with Timezone Offset in RSS Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**30. Time Formatting with Timezone Offset in W3C Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

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

```python
from flask import Flask, render_template

app = Flask(__name__)

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

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

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**33. Time Formatting with Timezone Offset in POSIX Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

**34. Time Formatting with Timezone Offset in Z Format**

```python
from flask import Flask, render_template

app = Flask(__name__)

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

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

```python
from flask import Flask, render_template

app = Flask(__name__)

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

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

```python
from flask import Flask, render_template

app = Flask(__name__)

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