Create your views here from django template import Context from django

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
# Create your views here
from django.template import Context
from django.shortcuts import render_to_response
import datetime
def current_datetime(request):
now = datetime.datetime.now()
c = Context({
'current_date': now
})
return render_to_response('current_datetime.html', c)
def hours_ahead(request, offset):
offset = int(offset)
dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
html = "<html><body>In %s hour(s), it will be %s.</body></html>" % (offset, dt)
return render_to_response(__name__+'.html', c)