def for_json(self):
value = super(DatetimeField, self).for_json()<EOL>if isinstance(value, pendulum.Interval):<EOL><INDENT>return value.in_seconds() * <NUM_LIT:1000><EOL><DEDENT>if isinstance(value, datetime):<EOL><INDENT>return self.format_datetime(value)<EOL><DEDENT>if isinstance(value, pendulum.Time):<EOL><INDENT>return str(value)<EOL><DEDENT>if isinstance(value, pendulum.Date):<EOL><INDENT>return value.to_date_string()<EOL><DEDENT>
Return date ISO8601 string formats for datetime, date, and time values, milliseconds for intervals