It looks like you have a Unix timestamp with milliseconds (the 000
) on the end, plus a timezone identifier. You should be able to construct that with the date formatting flags UvO
(unix time, milliseconds, timezone)
(These are in my timezone, -06:00
)
echo date('UvO');
// 1611339488000-0600
// Surround it with the /Date()/ it requests
// Encode it as JSON wherever is appropriate in your code
echo json_encode('/Date(' . date('UvO') . ')/');
// "/Date(1611339460000-0600)/"
Assuming you have your dates in DateTime
objects, call their format()
method to produce your desired date format.
// create your DateTime as appropriate in your application
$yourdate = new DateTime();
echo json_encode('/Date(' . $yourdate->format('UvO') . ')/');
// Set it ahead 1 day in the future
$yourdate->modify('+1 day');
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…