Is there a way or cypher query to add current timestamp in csv file name while exporting csv

Hello Everyone,

Greetings !!

I am looking for a help or suggestion for below question -

Is there a way or cypher query to add current timestamp in csv file name while exporting csv from neo4j using below query -

CALL apoc.export.csv.query("MATCH (s:SITE_CODE) RETURN
s.SITE_TYPE AS SITETYPE,
s.ENERGY_TYPE AS ENERGY_TYPE,
s.SITE_R4G_STATE AS R4GSTATE","/tmp/Site.csv",{d:','});

So what i need is file name looks like /tmp/Site_datetime.csv

datetime should have current date and time value.

Please let me know if anyone knows.

Thanks !!

Regards
AM

yes. maybe not the most elegant but

with "/tmp/file" + toString(datetime()) + ".csv" as file2 CALL apoc.export.csv.query("MATCH (s:SITE_CODE) RETURN
s.SITE_TYPE AS SITETYPE,
s.ENERGY_TYPE AS ENERGY_TYPE,
s.SITE_R4G_STATE AS R4GSTATE",file2,{d:','}) yield file return file;

to which this will create a /tmp/file2020-12-22T17:33:08.253Z.csv

1 Like