Hello,
Try these in build functions from MySQL

mysql> select year('2014-09-17 12:22:16'), month('2014-09-17 12:22:16'), 
day('2014-09-17 12:22:16'), hour('2014-09-17 12:22:16');
+

Prashant Ramhit
Administrator - Performance Mgt Systems
Emtel Ltd.
Mobile: +230 5 499 4911
Sent from my Emtel Smart Device

This email and all contents are subject to the following 
Disclaimer:"<http://www.emtel.com/email-disclaimer.php>"-----------------------------+------------------------------+----------------------------+-----------------------------+
| year('2014-09-17 12:22:16') | month('2014-09-17 12:22:16') | day('2014-09-17 
12:22:16') | hour('2014-09-17 12:22:16') |
+-----------------------------+------------------------------+----------------------------+-----------------------------+
|                        2014 |                            9 |                  
       17 |                          12 |
+-----------------------------+------------------------------+----------------------------+-----------------------------+

Use it with nested queries for a range of dates.



________________________________________
From: Mihail Manolov [mihail.mano...@liquidityservices.com]
Sent: 19 September 2014 03:20
To: <m...@jopoy.com>
Cc: mysql@lists.mysql.com
Subject: Re: extract year-month-day-hour

Try this:

LEFT('2014-09-17 12:22:16', 13)


Mihail Manolov
Senior Manager, Database
Liquidity Services, Inc.
1920 L Street NW
Washington DC 20036
202-467-6868 x3227 (Office)
202-256-9044 (Mobile)


mihail.mano...@liquidityservices.com
LiquidityServicesInc.com
> On Sep 18, 2014, at 18:31, Jopoy Solano <m...@jopoy.com> wrote:
>
> Hi!
>
> I want to say sorry in advance for my ignorance. I was wondering how can I
> extract year-month-day-hour in one go. For example:
>
> From "2014-09-17 12:22:16" to "2014-09-17 12"
>
> The reason for this is I'm trying to generate how much data users
> historically consume every hour  for each day.
>
> Thank you.
>
> Jopoy

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql

Reply via email to