def test_04(self): dt_pivot = datetime(2022, 2, 2, 22, 22, 22, 222222) hyp = DatetimeTool.floor( dt_pivot, DatetimeUnit.MILLISECOND, ) ref = datetime(2022, 2, 2, 22, 22, 22, 222000) self.assertEqual(hyp, ref)
def tz2now(cls, tz): dt_natural = DatetimeTool.tz2now(tz) dt_truncated = DatetimeTool.floor(dt_natural, unit=DatetimeUnit.MILLISECOND) return dt_truncated