updated server-side datetime object creation function