添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
  • Neo4j Connector for Apache Spark
  • Neo4j Connector for Apache Kafka
  • Change Data Capture (CDC)
  • BigQuery to Neo4j
  • Google Cloud to Neo4j
  • Neo4j 3.4 saw the introduction of the temporal date type , and while there is now powerful in built functionality, converting strings to dates is still a challenge.

    If our string is in the format yyyy-MM-dd we can call the date function with that string and have it converted to a date automatically:

    RETURN date("2019-06-04") AS date

    Executing this query will return the following result:

    One way we can solve this problem is by manually parsing our string into its different components using the split function. We can then create a date from those components:

    WITH [item in split("20/07/2018", "/") | toInteger(item)] AS dateComponents
    RETURN date({day: dateComponents[0], month: dateComponents[1], year: dateComponents[2]}) AS date

    Executing this query will return the following result:

    Alternatively we can use the APOC library’s apoc.date.parse function to massage our data into a supported format. This function gives us a flexible way for handling different date and time patterns.

    The following query:

    Uses the apoc.date.parse function to convert our dd/MM/yyyy date string into a timestamp in milliseconds

    Creates a datetime from that timestamp

    Creates a date from that datetime

    © 2025 Neo4j, Inc.
    Terms | Privacy | Sitemap

    Neo4j ® , Neo Technology ® , Cypher ® , Neo4j ® Bloom and Neo4j ® Aura are registered trademarks of Neo4j, Inc. All other marks are owned by their respective companies.