PHP Класс lsolesen\pel\PelEntryTime

This class can hold a timestamp, and it will be used as in this example where the time is advanced by one week: $entry = $ifd->getEntry(PelTag::DATE_TIME_ORIGINAL); $time = $entry->getValue(); print('The image was taken on the ' . date('jS', $time)); $entry->setValue($time + 7 * 24 * 3600); The example used a standard UNIX timestamp, which is the default for this class. But the Exif format defines dates outside the range of a UNIX timestamp (about 1970 to 2038) and so you can also get access to the timestamp in two other formats: a simple string or a Julian Day Count. Please see the Calendar extension in the PHP Manual for more information about the Julian Day Count.
Автор: Martin Geisler ([email protected])
Наследование: extends lsolesen\pel\PelEntryAscii
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__construct ( $tag, $timestamp, $type = self::UNIX_TIMESTAMP ) Make a new entry for holding a timestamp.
convertGregorianToJd ( integer $year, integer $month, integer $day ) : integer Converts a date in year/month/day format to a Julian Day count.
convertJdToGregorian ( $jd ) : array Converts a Julian Day count to a year/month/day triple.
convertJdToUnix ( integer $jd ) : mixed Converts a Julian Day count to a UNIX timestamp.
convertUnixToJd ( integer $timestamp ) : integer Converts a UNIX timestamp to a Julian Day count.
getValue ( $type = self::UNIX_TIMESTAMP ) : integer Return the timestamp of the entry.
setValue ( $timestamp, $type = self::UNIX_TIMESTAMP ) Update the timestamp held by this entry.

Описание методов

__construct() публичный Метод

Make a new entry for holding a timestamp.
public __construct ( $tag, $timestamp, $type = self::UNIX_TIMESTAMP )

convertGregorianToJd() публичный Метод

Converts a date in year/month/day format to a Julian Day count.
public convertGregorianToJd ( integer $year, integer $month, integer $day ) : integer
$year integer the year.
$month integer the month, 1 to 12.
$day integer the day in the month.
Результат integer the Julian Day count.

convertJdToGregorian() публичный Метод

Converts a Julian Day count to a year/month/day triple.
public convertJdToGregorian ( $jd ) : array
Результат array an array with three entries: year, month, day.

convertJdToUnix() публичный Метод

Converts a Julian Day count to a UNIX timestamp.
public convertJdToUnix ( integer $jd ) : mixed
$jd integer the Julian Day count.
Результат mixed $timestamp the integer timestamp or false if the day count cannot be represented as a UNIX timestamp.

convertUnixToJd() публичный Метод

Converts a UNIX timestamp to a Julian Day count.
public convertUnixToJd ( integer $timestamp ) : integer
$timestamp integer the timestamp.
Результат integer the Julian Day count.

getValue() публичный Метод

The timestamp held by this entry is returned in one of three formats: as a standard UNIX timestamp (default), as a fractional Julian Day Count, or as a string.
public getValue ( $type = self::UNIX_TIMESTAMP ) : integer
Результат integer the timestamp held by this entry in the correct form as indicated by the type argument. For {@link UNIX_TIMESTAMP} this is an integer counting the number of seconds since January 1st 1970, for {@link EXIF_STRING} this is a string of the form 'YYYY:MM:DD hh:mm:ss', and for {@link JULIAN_DAY_COUNT} this is a floating point number where the integer part denotes the day count and the fractional part denotes the time of day (0.25 means 6:00, 0.75 means 18:00).

setValue() публичный Метод

Update the timestamp held by this entry.
public setValue ( $timestamp, $type = self::UNIX_TIMESTAMP )