PHP: px_timestamp2string - Manual

downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

px_update_record px_set_value

Last updated: Sat, 27 Jan 2007

view this page in

# px_timestamp2string

(PECL)

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 milliseconds since 1.1.0000. 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` в случае возникновения ошибки.

## Примеры

Пример 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)."\n";
/* Turn it into a timestamp as it stored in a paradox database */
/* Timestamps are stored in milli seconds since 1.1.0000 */
$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")."\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 milli seconds.

## Смотрите также

px_date2string()
jdtogregorian()

add a note User Contributed Notes
px_timestamp2string
There are no user contributed notes for this page.
px_update_record px_set_value

Last updated: Sat, 27 Jan 2007
show source | credits | stats | sitemap | contact | advertising | mirror sites
Copyright © 2001-2007 The PHP Group
All rights reserved.
This mirror generously provided by: Yahoo! Inc.
Last updated: Sat Mar 10 10:36:09 2007 PST