question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Initialize from existing `datetime.date` object?

See original GitHub issue

pendulum.instance(dt) works for datetime.datetime, but how can I initialize a Pendulum object from an existing datetime.date (specifically a Django DateField)?


My current workaround:

pendulum.parse(str(date_object))

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:9
  • Comments:15 (1 by maintainers)

github_iconTop GitHub Comments

17reactions
jacebrowningcommented, Jul 21, 2018

Could we add that behavior to pendulum.instance()?

3reactions
madisvaincommented, Apr 27, 2021

I would like to pump this. I find doing this over and over and would love if pendulum had this feature built in.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python datetime (With Examples) - Programiz
In this program, we have used today() method defined in the date class to get a date object containing the current local date....
Read more >
c# - How to initialize a DateTime field? - Stack Overflow
I have to initialize some DateTime fields into an object but I have some problems doing it. In particular I am trying to...
Read more >
Python Create Date Object - W3Schools
To create a date, we can use the datetime() class (constructor) of the datetime module. The datetime() class requires three parameters to create...
Read more >
How to convert date to datetime in Python? - Tutorialspoint
In this article, we will discuss how to convert a date to a datetime object in python. We use the combine method from...
Read more >
Date() constructor - JavaScript - MDN Web Docs - Mozilla
The Date() constructor can create a Date instance or return a string representing the current time.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found