Creating custom module: cdr_mongodb.so

Hi, I am creating a module for save CDR on mongodb DB, but I have a little problem, How can I save the start date, answer date and end date with local time? What function must I use?

Thanks!

This is not a developer resource.