Skip to content

Consistent date time object #1144

@schloerke

Description

@schloerke

I think the changelog should mention that this is a potentially breaking change, since the returned object is different, and the string formatting is different.

now = datetime.utcnow().timestamp()

y = datetime.utcfromtimestamp(now)
y
#> datetime.datetime(2024, 2, 21, 5, 37, 58, 761000)
print(y)
#> 2024-02-21 05:37:58.761000

x = datetime.fromtimestamp(now, timezone.utc)
x
#> datetime.datetime(2024, 2, 21, 5, 37, 58, 761000, tzinfo=datetime.timezone.utc)
print(x)
# 2024-02-21 05:37:58.761000+00:00

Originally posted by @wch in #1142 (comment)


The returned value should have the same original print method and eject. However, we should not use the deprecated methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions