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

Added apoc.date.convert() and apoc.date.add() #291

Merged
merged 2 commits into from
Mar 6, 2017

Conversation

InverseFalcon
Copy link
Collaborator

This fulfills the feature request in #289.

@InverseFalcon InverseFalcon changed the title Added apoc.date.convert() and apoc.date.add() and unit tests Added apoc.date.convert() and apoc.date.add() Feb 21, 2017
@@ -136,6 +136,19 @@ public String systemTimezone() {
return TimeZone.getDefault().getID();
}

@UserFunction
@Description("apoc.date.convert(12345,'ms|s|m|h|d','ms|s|m|h|d') convert a time unit into a different time unit")
public Long convert(@Name("time") long time, @Name(value = "unit") String unit, @Name(value = "toUnit") String toUnit) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any sensible default values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe 'ms' for the unit value, but I'm wondering if in this case a default value would be easier to work with or make usage more error-prone.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not worth it then.

@jexp
Copy link
Member

jexp commented Feb 24, 2017

looks good to me, can you add them to docs/overview.adoc too?

@@ -136,6 +136,19 @@ public String systemTimezone() {
return TimeZone.getDefault().getID();
}

@UserFunction
@Description("apoc.date.convert(12345,'ms|s|m|h|d','ms|s|m|h|d') convert a time unit into a different time unit")
public Long convert(@Name("time") long time, @Name(value = "unit") String unit, @Name(value = "toUnit") String toUnit) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not worth it then.

@jexp jexp merged commit cd61246 into neo4j-contrib:3.1 Mar 6, 2017
@InverseFalcon InverseFalcon deleted the DateAdditions branch March 6, 2017 05:02
InverseFalcon added a commit to InverseFalcon/neo4j-apoc-procedures that referenced this pull request Mar 13, 2017
* Added apoc.date.convert() and apoc.date.add() and unit tests

* Added documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants