update datetime calculation function
fix tabs