如何使用'=>'将日期字符串连接到另一个字符串
How to concat date string to another string using '=>'
string1 = "Incident is created";
string2 = "2020-08-01T02:00:45.000Z"
我想连接两个字符串,以便最终输出如下所示:
2020-08-01=>Incident is created
我正在做 string1.concat(string2)
但它没有给出所需的输出。
使用split()
string1 = "Incident is created";
string2 = "2020-08-01T02:00:45.000Z"
res = string2.split("T")[0]+"=>"+string1
console.log(res)
您可以简单地最简单的方法是使用concat and split()
let string1 = "Incident is created";
let string2 = "2020-08-01T02:00:45.000Z"
let string3 = '=>'
let concat = string2.split('T')[0].concat(string3, string1);
console.log(concat) //2020-08-01=>Incident is created
string1 = "Incident is created";
string2 = "2020-08-01T02:00:45.000Z"
我想连接两个字符串,以便最终输出如下所示:
2020-08-01=>Incident is created
我正在做 string1.concat(string2)
但它没有给出所需的输出。
使用split()
string1 = "Incident is created";
string2 = "2020-08-01T02:00:45.000Z"
res = string2.split("T")[0]+"=>"+string1
console.log(res)
您可以简单地最简单的方法是使用concat and split()
let string1 = "Incident is created";
let string2 = "2020-08-01T02:00:45.000Z"
let string3 = '=>'
let concat = string2.split('T')[0].concat(string3, string1);
console.log(concat) //2020-08-01=>Incident is created