On 20 Jul 2012, at 6:19 AM, Andrew wrote:
> I'm not sure if web2py has something built-in to do this calculation but for 
> other similar issues in the past I've just converted my dates to epoch and 
> done the necessary math to see the difference between the two date-times. 

web2py ordinarily deals with datetime fields as Python datetime objects, which 
can just be compared (with due allowance for timezones). request.now has the 
current local time as a datetime; request.utcnow has UTC.

I use epoch dates myself in some cases, in particular to communicate with iOS 
clients through JSON, passing them as integers. The Python docs have quite a 
bit of material on manipulating dates, though it's a bit confusing in places. 
The modules of most interest are datetime, time and calendar.

> 
> On Thursday, July 19, 2012 4:05:41 AM UTC-5, Amit wrote:
> Hi,
> I have some records in a table and each record is having one field of type 
> datetime [fromat : 2012-07-19 23:12:0 (YYYY-MM-DD HH:MM:SS)], table structure 
> is:
> 
> Emp_ID
> Emp_Name
> Emp_Address
> Emp_Salary
> updated_on(Type: datetime)
> 
> periodically getting data against each Emp_ID and updating to the particular 
> record, every 20 mins data has to be updated for each Emp_ID, for e.g : 
> suppose for one Emp_ID data has updated on 2012-07-19 10:10:00 then again it 
> has to update on 2012-07-19 10:30:00 etc...
> 
> and if data is not updated in 20 mins then one scheduler will verify against 
> the updated_on column value and inform user that data has not updated  for 
> particular employee.
> 
> Problem facing:
> How to compare current datetime with updated_on coulmn value in web2py? can 
> anybody please share me the code to achieve the same?
> 
> 


-- 



Reply via email to