Replies: 2 comments 2 replies
-
|
The docs on to_datetime have a section about how to convert local_datetime to datetime. https://www.edgedb.com/docs/stdlib/datetime#function::std::to_datetime You just need to scroll a bit |
Beta Was this translation helpful? Give feedback.
2 replies
-
Hm, how is it incorrect? Here's how I'd do it: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
So I have a birth date as cal::local_date in the table, and want to create a computed property
agethat returns the age in years at the current date.The workign solution I came up with is:
but it's incorrect as it's using relative_duration. I could not find how to "cast"
local_datetodatetime, so ended up trying string representation oflocal_dateconcatenated with noon time:but when I run:
it yields an error I can't understand:
I tried to play with formatting options (like
to_datetime(to_str(Person.birth_date)++'T12:00:00+00', 'YYYY-MM-DDTHH:MI:SS TZH')), but received the same error.So, two questions:
Beta Was this translation helpful? Give feedback.
All reactions