Re: timestamp value management

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I use this function:

function	xlate_datetime($in_field, $in_format)
{
	// 2005-10-02 18:05:52
	// 0123456789012345678

	$year	= substr( $in_field,  0, 4 );
	$month	= substr( $in_field,  5, 2 );
	$day	= substr( $in_field,  8, 2 );
	$hour	= substr( $in_field, 11, 2 );
	$min	= substr( $in_field, 14, 2 );
	$sec	= substr( $in_field, 17, 2 );
	$t		= mktime( $hour, $min, $sec, $month, $day, $year );

	if ( $in_field == "0000-00-00 00:00:00" )
		return "";
	else
		return (date($in_format, $t));
}

Gerry



On 1/30/06, xkorakidis <xkorakidis@xxxxxxxx> wrote:
> hi guys!
> I'm trying to manage a table containing a timestamp colum
> - when I insert a record, I don't fill a value in timestamp column, so
> current timestamp is inserted. The inserted value is smth like
> 20060129213253
> - when I try to show this value in a php page, I use
> date($varOfTimestampColumn) or getdate(). The final result is the
> highest possible date (smth like January 19 2038 I think)
>
> How can I manage the timestamp field so as to show the correct value?
> Thanks!
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Gerry
http://portal.danen.org/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux