Trying to solve a problem with writing datetime events.