# how to limit datetime in x axis

Hello folks, I am trying to plot three variables in a single XY plot. I am having a problem setting the x-axis limit which is for time. I tried setting limits using x_limit but getting error. I will provide the code I am using and also the fig I got. If anyone can help me in this regard it will be much appreciated.

   import matplotlib.pyplot as plt
from   netCDF4 import *
import netCDF4
import numpy as np
from datetime import datetime
import pandas as pd
import matplotlib.dates as mdates
myFmt = mdates.DateFormatter('%b %d')
time = df.Date
temp = df.air_tmp
prs = df.Pressure
fig = plt.figure(figsize=(8,4))
ax.set_facecolor("#f1f1f1")
#ax = plt.axes([1, 1, 0.7, 0.7])
lns1 =ax.plot(time, sst,'-' "r",label='SST')
lns2 =ax.plot(time, temp,'-' "g",label='AIR')
ax2 = ax.twinx()
lns3 =ax2.plot(time, prs,'-' "b",label='PRESSURE')
ax.set_ylim(26,29)
ax2.set_ylim(920,1010)
legend=fig.legend(loc ="upper right",bbox_to_anchor=
(.21,.8),bbox_transform=ax.transAxes,frameon=False)
legend.get_frame().set_facecolor('none')
##########################################
import matplotlib.dates as mdates
myFmt = mdates.DateFormatter('%b %d')
ax.xaxis.set_major_locator(mdates.DayLocator(interval=1))
ax.xaxis.set_major_formatter(myFmt)
#plt.grid(True)
ax.grid()
ax.set_xlabel("DAY")
ax.set_ylabel(r"SST/AIR TEMPERATURE($$^\circ$$C)")
ax2.set_ylabel("PRESSURE(hpa)")
#ax.set_xlim(0,37)


df_subset = df[(df["Date"] < end_date) & (df["Date"] > start_end)]