Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysdate function returns string instead of date if params are defined #5060

Closed
motih78 opened this issue Oct 6, 2015 · 5 comments
Closed
Assignees
Labels
Milestone

Comments

@motih78
Copy link

motih78 commented Oct 6, 2015

Hi,

When calling the sysdate function without params, a property of type datetime is created with the default date format.

However - when providing a custom date format and / or timezone, the function returns a string.
I would expect that the function will return date even when we pass params - this behavior is giving us a headache since the datatype in the database is not consistent. It should be datetime regardless if params are sent or not.

Thanks,
Moti.

@lvca
Copy link
Member

lvca commented Oct 7, 2015

Why are you using sysdate instead of date?

@lvca lvca added the question label Oct 7, 2015
@lvca lvca self-assigned this Oct 7, 2015
@lvca lvca added this to the 2.1.x (next hotfix) milestone Oct 7, 2015
@motih78
Copy link
Author

motih78 commented Oct 7, 2015

Hi,

I'm doing an insert via SQL and i want the current date to be used without me needing to specify the date as string from the outside.

Thanks,
Moti.

@lvca
Copy link
Member

lvca commented Oct 7, 2015

Ok, so why don't use sysdate() ?

@motih78
Copy link
Author

motih78 commented Oct 7, 2015

Because i want it in UTC for example, or any other timezone, and i don't want the same format / timezone for all the tables in the DB (thus alter database dateformat "dd MMMM yyyy" is not an option)
Point is - a date function should return a single type - date and not date or string.

If format / timezone manipulation should be done outside of the scope of the function, then it should't receive params at all.

@lvca lvca modified the milestones: 2.1.x (next hotfix), 2.2 Oct 26, 2015
@lvca lvca modified the milestones: 2.2.0-beta, 2.2.0-rc1 Dec 13, 2015
@lvca lvca modified the milestones: 2.2.0-rc1, 2.2.0 GA May 7, 2016
@lvca
Copy link
Member

lvca commented May 9, 2016

It makes no sense calling sysdate() with a format if you want the current date. The format or timezone don't change the "now" that is now no matters the format or timezone. About the returning type I could agree with you that could be confusing, but I prefer to document it better than remove this feature. Closing this issue.

@lvca lvca closed this as completed May 9, 2016
lvca added a commit to orientechnologies/orientdb-docs that referenced this issue May 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants