I created a form with a DateField and a TimeField. When printing these from the routes.py I get these example values:

```
TimeField: 17:30:00
DateField: 2021-07-12

```

How can I turn those values into a datetime object, which I can submit to my Postgres Database? The required object format is DateTime. The Postgres Table is set up as TIMESTAMPTZ. I tried replace() to add the time to the DateField Data. But that does not work. I am new to datetimes and such, so please excuse my ignorance. How do the Timezones work? because I probably need to add the timezone somehow for the TIMESTAMPTZ, right?

Below is the minimal code for the functioning

forms.py

```
class CreateEvent(Form):
    dt = DateField('DateTimePicker')
    start_time = TimeField('Start')
    submit = SubmitField("Submit") 
models.py

class Events(db.Model):
    __tablename__='events'
    eid = db.Column(db.Integer, primary_key = True)
    event_day = db.Column(db.DateTime, nullable=False)
    start_time = db.Column(db.DateTime, nullable=False)

    def __init__(self, event_day, start_time):
        self.event_day = event_day
        self.start_time = start_time

```

routes.py

```
if request.method == 'POST':
    if form.validate() == False:
        return render_template('create.html', form=form)
    else:
        event_day = form.dt.data
        start_time = form.start_time.data
        print(start_time)
        print(event_day)
        start_time = event_day.replace(time=start_time)
        newevent = Events(event_day, start_time)
        db.session.add(newevent)
        db.session.commit()
        return "Success"

```

Just in case, here is the Postgres Create Statement for the table:

```
CREATE TABLE events (
    eid serial PRIMARY KEY NOT NULL,
    event_day TIMESTAMPTZ NOT NULL,
    start_time TIMESTAMPTZ NOT NULL,
);

```