我已经搜索并看到了如何找到时间之间的差异,但是在使用时如何使用用户输入的日期?任何帮助表示赞赏。谢谢。
const activity = $('#activity').val();
const startValue = $('#start-time').val();
const endValue = $('#end-time').val();
const date = $('#date').val();
const timeStart = new Date("date" + startValue).getHours();
const timeEnd = new Date("date" + endValue).getHours();
const inBetween = timeEnd - timeStart;
答案 0 :(得分:0)
您可以这样做...
from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
# create new figure, axes instances
fig = plt.figure(dpi=150)
ax = fig.add_axes([0.1,0.1,0.8,0.8])
# setup mercator map projection
map = Basemap(projection='merc',llcrnrlat=-58,urcrnrlat=80,
llcrnrlon=-180,urcrnrlon=180,resolution='c')
map.drawcoastlines(linewidth=0.50)
map.fillcontinents()
map.drawmapboundary()
# Declare and register callbacks for zoom control
def on_lims_change(axes):
xrange = abs(ax.get_xlim()[1] - ax.get_xlim()[0])
yrange = abs(ax.get_xlim()[1] - ax.get_xlim()[0])
# try to change map resolution based on zoom level
if max(xrange,yrange) < 1E7 and max(xrange,yrange) > 1E6: # 'l' = low
map.resolution = 'l'
elif max(xrange,yrange) < 1E6 and max(xrange,yrange) > 5E5: # 'i' = intermeditate
map.resolution = 'i'
elif max(xrange,yrange) < 5E5 and max(xrange,yrange) > 1E5: # 'h' = high
map.resolution = 'h'
elif max(xrange,yrange) < 1E5: # 'f' = full
map.resolution = 'f'
else: # 'c' = coarse
map.resolution = 'c'
print(map.resolution)
map.drawcoastlines(linewidth=0.50)
map.fillcontinents()
map.drawmapboundary()
ax.callbacks.connect('xlim_changed', on_lims_change)
plt.show()
Here,您可以找到更详细的答案。