I'm trying to find a way to find the true timestamp of the DateTime object I've already dressed down from a epoch moment. This has need of a trick or two to fully complete this bit of nonce code.
do
{
$m = $n;
echo "!!". $m->getTimestamp() ."\r\n";
$m = date("zHisu",(int)$n->getTimestamp());
$n = \DateTime::createFromFormat("zHisu", $m);
$y++;
} while ($y < 3);
$y = 0;
do
{
$m = $n;
echo "!!". $m->getTimestamp() ."\r\n";
$m = date("U",(int)$n->getTimestamp());
$n = \DateTime::createFromFormat("U", $m);
$y++;
} while ($y < 3);
This is what comes out of the WSL PHP CLI I'm using. As I showed above, I'm simply getting a smaller number out of the larger one. "zHisu" (days, Hours, minutes, seconds, microseconds) I expected to use my second loop above to transpose the timestamp into a larger number, essentially getting this first number below from the ones below; in a singularity.\
Unfortunately it just comes back. I want to know if I should just take the time by my own self, and leave it be instead of working with the OOP, or does anyone have a fix for this?
*****31071534811253261
!!1661176061
!!1661176061
!!1661176061
!!1661176061
!!1661176061
!!1661176061
?????1661176061
source https://stackoverflow.com/questions/71651860/how-can-i-return-a-datetime-object-from-its-date-to-its-epoch-time
No comments:
Post a Comment