Snippets Collections
let timeStamp = Date().timeIntervalSince1970
let date = NSDate(timeIntervalSince1970: timeStamp)
let dayTimePeriodFormatter = DateFormatter()
dayTimePeriodFormatter.dateFormat = "dd MMMM,yyyy.hh:mm a"
let dateTimeString = dayTimePeriodFormatter.string(from: date as Date)
let dateTime = dateTimeString.split(separator: ".")
print( "Date = \(dateTime[0])")
print( "Time = \(dateTime[1])")
//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]}}

Save snippets that work with our extensions

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