文字

px_timestamp2string

(PECL paradox >= 1.4.0)

px_timestamp2string Converts the timestamp into a string.

说明

string px_timestamp2string ( resource $pxdoc , float $value , string $format )

Turns 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.

参数

pxdoc

Resource identifier of the paradox database.

value

Value as stored in paradox database field of type PX_FIELD_TIME, or PX_FIELD_TIMESTAMP.

format

String format similar to the format used by date() . The placeholders support by this function is a subset of those supported by date() (Y, y, m, n, d, j, H, h, G, g, i, s, A, a, L).

返回值

成功时返回 TRUE , 或者在失败时返回 FALSE

范例

Example #1 Turn a paradox timestamp into a human readable form

<?php
$px 
px_new ();




$days  700000 ;



echo  jdtogregorian ( $days + 1721425 ). "\n" ;



$stamp  $days  86400.0  1000.0 ;

$stamp  +=  3600000.0 ;

echo  px_timestamp2string ( $px $stamp "n/d/Y H:i:s" ). "\n" ;

px_delete ( $px );
?>

以上例程会输出:

7/15/1917
7/15/1917 01:00:00

The Julian day count as passed to jdtogregorian() 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.

参见

  • px_date2string() - Converts a date into a string.
  • jdtogregorian() - 转变一个Julian Day计数为Gregorian历法日期
上一篇: 下一篇: