from django shortcuts import render_to_response import datetime def cu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
from django.shortcuts import render_to_response
import datetime
def current_datetime(request, offset=0):
#now = datetime.datetime.now()
offset = int(offset)
now = datetime.datetime.now() + datetime.timedelta(hours=offset)
return render_to_response('current_datetime.html', {'current_date': now})
def hours_ahead(request, offset):
offset = int(offset)
dt = datetime.datetime.now() + datetime.timedelta(hours=offset)
return render_to_response('hours_ahead.html', {'hour_offset': offset, 'next_time': dt})