Query: px_timestamp2string
OS: php
Section: 3
Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar
PX_TIMESTAMP2STRING(3) PX_TIMESTAMP2STRING(3) px_timestamp2string - Converts the timestamp into a string.SYNOPSISstring px_timestamp2string (resource $pxdoc, float $value, string $format)DESCRIPTIONTurns a timestamp as it stored in the paradox file into human readable format. Paradox timestamps are the number of miliseconds since 0001-01-02. This function is just for convenience. It can be easily replaced by some math and the calendar functions as demonstrated in the following example.PARAMETERSo $pxdoc - Resource identifier of the paradox database. o $value - Value as stored in paradox database field of type PX_FIELD_TIME, or PX_FIELD_TIMESTAMP. o $format - String format similar to the format used by date(3). The placeholders support by this function is a subset of those supported by date(3) (Y, y, m, n, d, j, H, h, G, g, i, s, A, a, L).RETURN VALUESReturns TRUE on success or FALSE on failure.EXAMPLESExample #1 Turn a paradox timestamp into a human readable form <?php $px = px_new(); /* make up a date as it could be stored in */ /* a date field of a paradox db. */ /* 700000 days since 1.1.0000. */ $days = 700000; /* Use the calendar functions to print a */ /* human readable format of the date */ echo jdtogregorian($days+1721425)." "; /* Turn it into a timestamp as it stored in a paradox database */ /* Timestamps are stored in miliseconds since 0001-01-02 */ $stamp = $days * 86400.0 * 1000.0; /* Add one hour */ $stamp += 3600000.0; /* The following will output '7/15/1917 01:00:00'. */ echo px_timestamp2string($px, $stamp, "n/d/Y H:i:s")." "; px_delete($px); ?> The above example will output: 7/15/1917 7/15/1917 01:00:00 The Julian day count as passed to jdtogregorian(3) has a different base of 1.1.4714 b.c. and must therefore be calculated by adding 1721425 to the day count used in the paradox file. Turning the day count into a timestamp is easily done by multiplying with 86400000.0 to obtain miliseconds.SEE ALSOpx_date2string(3), jdtogregorian(3). PHP Documentation Group PX_TIMESTAMP2STRING(3)
Related Man Pages |
---|
strtotime(3) - php |
gmdate(3) - php |
date_sunset(3) - php |
date_sunrise(3) - php |
px_create_fp(3) - php |
Similar Topics in the Unix Linux Community |
---|
Adding days to an input date. |
Grep content between timestamp |
How to get timestamp of a file in HPUX |
Script to filter by date |
Print character after pattern found |