Reputation: 935
I am using the getObjectInfo($bucket,$fileUri)
to get the details of the files I have on S3.
Now when I execute the function,I get a result as an array
Array
(
[time] => 1384861952
[hash] => c3c40e7df05a9d622bab85917d52abda
[type] => application/pdf
[size] => 331246
)
Array
(
[time] => 1384864779
[hash] => f5cb8cf703e43f2929bef44286cd1e60
[type] => application/pdf
[size] => 503772
)
I understand the size parameter would be in bytes and I have to convert it to maybe MB or KB.But the time attribute is a bit confusing.I am not sure if its the last modified time,because the name doesn't say that.
Also,the SDK(I use PHP SDK) function does not have a list of what the function actually returns.This is the function.
/**
* Get object information
*
* @param string $bucket Bucket name
* @param string $uri Object URI
* @param boolean $returnInfo Return response information
* @return mixed | false
*/
public static function getObjectInfo($bucket, $uri, $returnInfo = true)
{
$rest = new S3Request('HEAD', $bucket, $uri, self::$endpoint);
$rest = $rest->getResponse();
if ($rest->error === false && ($rest->code !== 200 && $rest->code !== 404))
$rest->error = array('code' => $rest->code, 'message' => 'Unexpected HTTP status');
if ($rest->error !== false)
{
self::__triggerError(sprintf("S3::getObjectInfo({$bucket}, {$uri}): [%s] %s",
$rest->error['code'], $rest->error['message']), __FILE__, __LINE__);
return false;
}
return $rest->code == 200 ? $returnInfo ? $rest->headers : true : false;
}
Does it actually return the modified time as it shows up on the S3 dashboard? OR it means something else?I need help to understand it.If its the modified time,what is the format(On the dashboard it add the GMT+ difference time)?The documentation is also not very clear.
Thank you for your time.
Upvotes: 0
Views: 3489
Reputation: 147
The number value near time is the epoch time, just submit it to the date function and specify your format:
<?php
echo date("Y-m-d H:i:s", NUMBER_HERE);
?>
or
<?php
echo date("Y-m-d H:i:s", 1384861952);
echo date("Y-m-d H:i:s", 1384864779);
?>
your two numbers return
2013-11-19 06:52:32
2013-11-19 07:39:39
Upvotes: 1