Snippets Collections
//Convert to UTC date only
{{new Date("timestamp from cdr here"*1000).toISOString()}}
//Convert to UTC time and date
{{new Date("timestamp from cdr here"*1000).toISOString().split('T')[0]}}
//Convert to UTC time and date without milliseconds
{{new Date("timestamp from cdr here"*1000).toISOString().slice(0,-8)}}
//Convert to Local time
{{new Date("timestamp from cdr here"*1000).toLocaleString('en-US',{ timeZone: 'America/Chicago' })}}

//Convert YYYY-MM-DD to YYYY-Month Name-DD
{{$node["SplitInBatches"].json["cdr_date"].split('-')[0]}}/{{new Date($node["SplitInBatches"].json["cdr_date"].split('-')[1]).toLocaleString('default', { month: 'long' })}}/{{$node["SplitInBatches"].json["cdr_date"].split('-')[2]}}

Wed Jul 07 2021 17:07:30 GMT+0000 (Coordinated Universal Time)

##javascript ##n8n #timestamp #date

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension