jfang
June 16, 2023, 8:11pm
1
Describe the problem/error/question
I am getting the _createTime value from a Google Cloud Firestore node and I am trying to format it to something Nocodb can take. However, I keep getting the invalid DateTime error. This was working previously in an earlier N8N release. Is there someone that could let me know why I am getting the error? Thanks.
{{ DateTime.fromISO($json["_createTime"]).toFormat('yyyy-MM-dd hh:mm:ss') }}
What is the error message (if any)?
Invalidate DateTime
Please share your workflow
Share the output returned by the last node
[
{
"created_date":
"Invalid DateTime"
}
]
Information on your n8n setup
n8n version: 0.231.2
Database (default: SQLite):
n8n EXECUTIONS_PROCESS setting (default: own, main):
Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
Operating system: Ubuntu 22.04 LTS
YOU CAN TRY:
{{ new Date($json[ā_createTimeā]).toISOString().replace(āTā, ā ').slice(0, -5) }}
or
{{ DateTime.fromISO($json[ā_createTimeā]).toUTC().toFormat(āyyyy-MM-dd HH:mm:ssā) }}
jfang
June 16, 2023, 9:25pm
3
Thanks Fernanda.
{{ new Date($json["_createTime"]).toISOString().replace('T', ' ').slice(0, -5) }}
works for me, but
{{ DateTime.fromISO($json["_createTime"]).toUTC().toFormat('yyyy-MM-dd HH:mm:ss') }}
does not.
1 Like
jfang
June 16, 2023, 9:36pm
4
It turns out the Timezone in the workflow Settings set to default seemed to have caused the error.
Once Iāve changed it to my local timezone, the original DateTime code works again.
{{ DateTime.fromISO($json["_createTime"]).toFormat('yyyy-MM-dd hh:mm:ss') }}
No more āInvalid DateTimeā.
3 Likes
jfang:
ateTime"]).
Amazing! I was having an issue today with the timezone too, mine was GMT -3 Sao Paulo, but it was setting it wrong so i had to search a solution to subtract 3 hoursā¦
system
Closed
June 23, 2023, 9:39pm
6
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.