RE: Conert MySQL date stamp

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

 



Dear Bimal,

When I store timestamps in a database I usually use the PHP time() function.
This will give you the Unix Epoch time and it is pretty easy to use this for
sorting of time and so on. Also it is easy to convert to any needed date and
time format.

If you are a heavy MySQL database user it might be better to use the DATE
type as you do today. For example it might be faster to do a date WHERE
statement then to do a normal WHERE clause on a INT field. Might be that
someone else knows about the pro and cons.

Hope this helps.

Best regards,
 
Fredrik Davidsson
Sweden

-----Original Message-----
From: Bimal Pouldel [mailto:bimal_kcmit@yahoo.com] 
Sent: den 20 september 2004 09:31
To: php-objects@yahoogroups.com
Subject:  Conert MySQL date stamp

Hi there,

I have to work extremely with the dates in the database; MySQL.
The general format is : YYYY-MM-DD HH:MM:SS, when we use DATE datatype for
mysql.

I want to have a number out of this string like database, so that I can sort
the database results based on the Hour, and munites. If a good idea is not
possible, should I use the PHP to get the date, calculate the different
values like year, date, minutes and get the number?

=========
This program is specailly used with the issues like, logging information,
where I store the date("Y-m-d h-i-s") into the database. I want to get the
hour and minute values out there.
======

If there is a better way, please let me know.

Thanx

=====
Bimal Poudel
(Information Management)
Kathmandu, Nepal

http://fakenepal.tripod.com


		
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 


------------------------ Yahoo! Groups Sponsor --------------------~--> Make
a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/
Yahoo! Groups Links



 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

PHP Data object relational mapping generator - http://www.meta-language.net/ 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-objects/

<*> To unsubscribe from this group, send an email to:
    php-objects-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Soap]     [Kernel Newbies]     [Yosemite]     [Yosemite Campsites]

  Powered by Linux