changed nsdate type into int64 in database
added a new function