Simple: Date Stamp mySQL and PHP

2002-01-24 Thread Shannon Kendrick

Hi all, 
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);


Thanks

Shannon


__
Do You Yahoo!?
Great stuff seeking new owners in Yahoo! Auctions! 
http://auctions.yahoo.com

-
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

2002-01-24 Thread Marcus Müller

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

2002-01-24 Thread DL Neil

What's this? PHP on the MySQL list - such heresy!!!

Do not pass go, go directly to: 
http://www.mysql.com/doc/D/a/Date_and_time_functions.html

=dn


- Original Message -
From: Marcus Müller [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: 24 January 2002 11:17
Subject: 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




-
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

2002-01-24 Thread Marcus Müller

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