Re: Conert MySQL date stamp

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

 



Hi Bimal,

You want to use DATE_FORMAT().. let me give you an example

If what it is you want to sort by hour / minute and disregard the other 
information in the date (ie, you don't care what day or year. Try the 
following:

SELECT *
FROM user_profiles
ORDER BY DATE_FORMAT(dt_lastupdated, '%H'), DATE_FORMAT(dt_lastupdated, 
'%"i"')

On Sep 20, 2004, at 3:31 AM, Bimal Pouldel wrote:

> 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
>
>
>
> PHP Data object relational mapping generator - 
> http://www.meta-language.net/
> Yahoo! Groups Links
>
>
>
>
>
>
>



------------------------ 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

<*> 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