Ian Gray wrote:
I am wanting one field on a table in one of my MYSQL databases to contain different dates and times as a epoch timestamps.

You're better off storing as a DATETIME field -- it has limits from 1000-01-01 to 9999-12-31, instead of 1970 to 2037..


Firstly how do I convert a particular time and date which the user will enter on the website into the epoch timestamp.

You need to use mktime() if you are getting the individual time segments (e.g. hour, minute, date, month).


And secondly, how do I convert it back once taken of the table. I'd like to use the date function to print out this particular date and time- for example $a = date('g:IA l, jS F, Y') so that $a could say '7:30PM Saturday, 23rd August, 2003' Does date only work by outputting the current date or time? Can you get it to output the format of any date and time you would like?

The date() function accepts a second parameter, which is a UNIX timestamp of your choice.


Regards,

David

--
David Grant
Web Developer

[EMAIL PROTECTED]
http://www.wiredmedia.co.uk

Tel: 0117 930 4365, Fax: 0870 169 7625

Wired Media Ltd
Registered Office: 43 Royal Park, Bristol, BS8 3AN
Studio: Whittakers House, 32 - 34 Hotwell Road, Bristol, BS8 4UD

Company registration number: 4016744

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************


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



Reply via email to