This topic is locked

Timestamp to convert

7/17/2008 11:28:03 AM
PHPRunner General questions
W
webdino author

In my Database is a field that contents a unix Timestamp, I show it in List Page but I want to see a Dateformat, Also the user shoul edit a date and the Timestamp was automatically calculatet.
Thanks

J
Jane 7/18/2008

Hi,
to show Unix timestamp as date use custom format on the "View as" settings dialog on the Visual Editor tab.

Here is a sample:

if ($value)

$value = date("d/m/Y",$value);


To convert entered date to timestamp on the add/edit pages use Before record added/updated events on the Events tab:

$values["FieldName"] = strtotime($values["FieldName"]);


More info about PHP functions here:

http://php.net/manual/en/ref.datetime.php