Re: Simple: Date Stamp mySQL and PHP
Hi, have a look at http://www.php.net/manual/en/function.date.php According to your example, it would be something like: ?php $date1=date(d M Y H:i, 20020123143547); ? Regards Marcus Ive got a timestamp in a database column and basically I was wondering if there was any function in PHP to parse the date into something more readable from 20020123143547 23 Jan 2002 14:35 something like $date1= datetoreadable($date); - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Simple: Date Stamp mySQL and PHP
Oops, got it all wrong. Thought it was a real timestamp, but it's already the date, only formatted in a different way. The date() function expects a Unix-timestamp as its second argument. Thus you could try to leave the conversion to MySQL by using UNIX_TIMESTAMP(your_timestamp_column) or if you want to do it in PHP use mktime(). http://www.php.net/manual/en/function.mktime.php ?php $date1=20020123143547; $date1_year=substr($date1, 0, 4); $date1_month=substr($date1, 4, 2); $date1_day=substr($date1, 6, 2); $date1_hour=substr($date1, 8, 2); $date1_minute=substr($date1, 10, 2); $date1_second=substr($date1, 12, 2); $date=date(d M Y H:i, mktime($date1_hour, $date1_minute, $date1_second, $date1_month, $date1_day, $date1_year); ? Hope that helps Marcus have a look at http://www.php.net/manual/en/function.date.php According to your example, it would be something like: ?php $date1=date(d M Y H:i, 20020123143547); ? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: Hoe to create indexes on existing tables
I had a set of tables which I exported from Access database. But now, I want to index these tables. How do I go about that? http://www.mysql.com/doc/A/L/ALTER_TABLE.html mysql ALTER TABLE your_table ADD KEY(your_column); Hope that helps Marcus - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php