Skip to content

Instantly share code, notes, and snippets.

@helloimalemur
Created May 23, 2024 18:56
Show Gist options
  • Save helloimalemur/a756749e57c12b3d289c2cde29c09fc3 to your computer and use it in GitHub Desktop.
Save helloimalemur/a756749e57c12b3d289c2cde29c09fc3 to your computer and use it in GitHub Desktop.
PHP -> Elasticsearch Index Timestamp Format
// PHP -> Elasticsearch Index Timestamp Format
$timestamp_pre = date("Y-m-d");
$timestamp_pose = date("H:i:s.u");
$tlen = strlen($timestamp_pose);
$tsub = substr($timestamp_pose, 0, $tlen-3);
$tsub = $tsub."Z";
$t = $timestamp_pre."T".$tsub;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment