Class PelEntryTime

Description

Class for holding a date and time.

This class can hold a timestamp, and it will be used as in this example where the time is advanced by one week:

  1.  $entry $ifd->getEntry(PelTag::DATE_TIME_ORIGINAL);
  2.  $time $entry->getValue();
  3.  print('The image was taken on the ' date('jS'$time));
  4.  $entry->setValue($time 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.

Located in /src/PelEntryAscii.php (line 172)

PelEntry
   |
   --PelEntryAscii
      |
      --PelEntryTime
Class Constant Summary
Method Summary
PelEntryTime __construct (int $tag, int $timestamp, [int $type = self::UNIX_TIMESTAMP])
int convertGregorianToJd (int $year, int $month, int $day)
array convertJdToGregorian (int $jd)
mixed convertJdToUnix (int $jd)
int convertUnixToJd (int $timestamp)
int getValue ([int $type = self::UNIX_TIMESTAMP])
void setValue (int $timestamp, [int $type = self::UNIX_TIMESTAMP])
Variables
Methods
Constructor __construct (line 232)

Make a new entry for holding a timestamp.

PelEntryTime __construct (int $tag, int $timestamp, [int $type = self::UNIX_TIMESTAMP])
  • int $tag: the Exif tag which this entry represents. There are only three standard tags which hold timestamp, so this should be one of the constants PelTag::DATE_TIME, PelTag::DATE_TIME_ORIGINAL, or PelTag::DATE_TIME_DIGITIZED.
  • int $timestamp: the timestamp held by this entry in the correct form as indicated by the third argument. For UNIX_TIMESTAMP this is an integer counting the number of seconds since January 1st 1970, for EXIF_STRING this is a string of the form 'YYYY:MM:DD hh:mm:ss', and for 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).
  • int $type: the type of the timestamp. This must be one of UNIX_TIMESTAMP, EXIF_STRING, or JULIAN_DAY_COUNT.

Redefinition of:
PelEntryAscii::__construct()
Make a new PelEntry that can hold an ASCII string.
convertGregorianToJd (line 362)

Converts a date in year/month/day format to a Julian Day count.

  • return: the Julian Day count.
int convertGregorianToJd (int $year, int $month, int $day)
  • int $year: the year.
  • int $month: the month, 1 to 12.
  • int $day: the day in the month.
convertJdToGregorian (line 380)

Converts a Julian Day count to a year/month/day triple.

  • return: an array with three entries: year, month, day.
array convertJdToGregorian (int $jd)
  • int $jd: the Julian Day count.
convertJdToUnix (line 416)

Converts a Julian Day count to a UNIX timestamp.

  • return: the integer timestamp or false if the day count cannot be represented as a UNIX timestamp.
mixed convertJdToUnix (int $jd)
  • int $jd: the Julian Day count.
convertUnixToJd (line 404)

Converts a UNIX timestamp to a Julian Day count.

  • return: the Julian Day count.
int convertUnixToJd (int $timestamp)
  • int $timestamp: the timestamp.
getValue (line 258)

Return the timestamp of the entry.

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.

  • return: the timestamp held by this entry in the correct form as indicated by the type argument. For UNIX_TIMESTAMP this is an integer counting the number of seconds since January 1st 1970, for EXIF_STRING this is a string of the form 'YYYY:MM:DD hh:mm:ss', and for 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).
int getValue ([int $type = self::UNIX_TIMESTAMP])

Redefinition of:
PelEntryAscii::getValue()
Return the ASCII string of the entry.
setValue (line 307)

Update the timestamp held by this entry.

void setValue (int $timestamp, [int $type = self::UNIX_TIMESTAMP])
  • int $timestamp: the timestamp held by this entry in the correct form as indicated by the third argument. For UNIX_TIMESTAMP this is an integer counting the number of seconds since January 1st 1970, for EXIF_STRING this is a string of the form 'YYYY:MM:DD hh:mm:ss', and for 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).
  • int $type: the type of the timestamp. This must be one of UNIX_TIMESTAMP, EXIF_STRING, or JULIAN_DAY_COUNT.

Redefinition of:
PelEntryAscii::setValue()
Give the entry a new ASCII value.

Inherited Methods

Inherited From PelEntryAscii

PelEntryAscii::__construct()
PelEntryAscii::getText()
PelEntryAscii::getValue()
PelEntryAscii::setValue()

Inherited From PelEntry

PelEntry::getBytes()
PelEntry::getComponents()
PelEntry::getFormat()
PelEntry::getIfdType()
PelEntry::getTag()
PelEntry::getText()
PelEntry::getValue()
PelEntry::setIfdType()
PelEntry::setValue()
PelEntry::__toString()
Class Constants
EXIF_STRING = 2 (line 181)

Constant denoting a Exif string.

JULIAN_DAY_COUNT = 3 (line 185)

Constant denoting a Julian Day Count.

UNIX_TIMESTAMP = 1 (line 177)

Constant denoting a UNIX timestamp.

Documentation generated on Thu, 05 May 2011 07:19:02 +0200 by phpDocumentor 1.4.3