Syntax The syntax goes like this: TIMEDIFF (expr1,expr2) 10 This question already has answers here : Calculate difference between 2 date / times in Oracle SQL (21 answers) Closed 5 months ago. Difference between letting yeast dough rise cold and slowly or warm and quickly. @Ganesh Allowed values are mentioned in the information icon which you can hover over. Should convert 'k' and 't' sounds to 'g' and 'd' sounds when they follow 's' in a word for pronunciation? In this case, the enddate is arrival and the startdate is departure. Contributed on Sep 30 2021 . i.e: (overall_seq => difference between) (1 => 1.4 - 1.1 ) (2 => 2.3 - 1.4) (3 => 3.3 - 2.3) (5 => 5.7 - 3.3) . Im waiting for my US passport (am a dual citizen). Find centralized, trusted content and collaborate around the technologies you use most. I did try below which sorta works but just for one main_activity only and also the sequences are fixed so this SQL does not handle all of the rules mentioned above. Some of the project_id status may have been marked as incomplete (like CC), these main_activity which is a difference between 2.3 and 3.3 should yield null. If section_seq 3 is missing then consider section_seq 2 provided section_seq 2 is complete. How can I shave a sheet of plywood into a wedge shim? Is there liablility if Alice scares Bob and Bob damages something? In MySQL 8.0 you can approach this problem with window functions, first computing the following values: Once you've done it, you can directly compute the difference in dates between max and min date, but only when the boundary status values are both not incomplete. There will be zero hours. I tried to use DATEDIFF function but it's wrong. Use a proper datetime type instead. 180 is a decent value. Why doesnt SpaceX sell Raptor engines commercially? Note This section doesn't address time zone considerations and time zone aware functions. I tried to use DATEDIFF function but it's wrong. Quick Example: -- The difference is days between today and yesterday SELECT DATEDIFF(dd, GETDATE() - 1, GETDATE()); -- Returns: 1 -- The number of seconds in 24 hours SELECT DATEDIFF(ss, GETDATE() - 1, GETDATE()); -- Returns: 86400 SQL Server - DATEDIFF - Datetime Difference in Seconds, Days, Weeks etc - SQLines Tools Home How to get time difference (in hours) between 2 dates [duplicate], Calculate difference between 2 date / times in Oracle SQL, Building a safer community: Announcing our new Code of Conduct, Balancing a PhD program with a startup career (Ep. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. To calculate the difference between two dates, you use the DATEDIFF () function. Making statements based on opinion; back them up with references or personal experience. select timediff('2016-12-16 08:00:00','2016-12-15 10:45:00') as HourMinute // 21: 15: 00 We make use of First and third party cookies to improve our user experience. Something like. Setting high values will only create issues with a single server design. My father is ill and booked a flight to see him - can I travel on my other passport? mysql> SELECT HOUR ('10:05:03'); -> 10 mysql> SELECT HOUR ('272:59:59'); -> 272. How common is it to take off from a taxiway? More info about Internet Explorer and Microsoft Edge, https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_wait_timeout. The first one needs to return them in the following format as a single column: The problem is that the query is giving only the difference in hours. If overall_seq 1 is not complete and section_seq 4 record is complete then diff of date should be null. mysql_fetch_array()/mysql_fetch_assoc()/mysql_fetch_row()/mysql_num_rows etc expects parameter 1 to be resource. 4. Is there a way to tap Brokers Hideout for mana? Not the answer you're looking for? An Azure managed MySQL database service for app development and deployment. Alternatively, for the difference between dates in minutes, hours, days, weeks, months, or years - SELECT TIMESTAMPDIFF (UNIT, `DATE-A`, `DATE-B`) FROM `TABLE`. You can concatenate the output of curdate() to a string containing the specific time . The reason for the smaller value is because of the single server architecture where all the connections were proxied through the gateway server. Your SQL works smiliar to SelVazi's response but is it possible to have the difference of dates calculated as per rule (overall_seq => difference between) (1 => 1.4 - 1.1 ) (2 => 2.3 - 1.4) (3 => 3.3 - 2.3) (5 => 5.7 - 3.3) . Some of the project_id status may have been marked as incomplete (like CC), these main_activity which is a difference between 2.3 and 3.3 should yield null. Wait_timout was set to 120 in a single server but in flexible sever it is 28800. I have a MySQL table which has sets of records that follow a sequence of events. MySQL DATEDIFF() returns the number of days between two dates or datetimes. If date difference is zero then what happen? I am trying to get the time difference between 2 users, I need the difference in hours. Let us walk through them quickly: To calculate the difference between dates in days - SELECT DATEDIFF (`DATE-A`, `DATE-B`) FROM `TABLE`. The queries are - SELECT TIMEDIFF ( "622:45:22", "15:10:33") AS TimeDifference; SELECT TIMEDIFF ( "555:23:07", "07:59:13") AS TimeDifference; Code language: SQL (Structured Query Language) (sql) And the output is - Limitation of the Time Data Type returns number of days between date1 and date2. Connect and share knowledge within a single location that is structured and easy to search. Yes I am storing the date fields as date time, just that they are represented as string in my question. Unlike TIMESTAMPDIFF, both dates need . . Why is there such a huge difference? Here is my code: Is there a place where adultery is a crime. Not the answer you're looking for? Note: time1 and time2 should be in the same format, and the calculation is time1 - time2. A current date (NOW ()) and an end_date. Why is this screw on the wing of DASH-8 Q400 sticking out, is it safe? The MYSQL TIMEDIFF() function accepts two time or, date-time values as parameters, calculates the difference between them (argument1-argument2) and returns the result. Why does a rope attached to a block move when pulled? Does the policy change for AI-generated content affect users who (want to) What is the difference between "INNER JOIN" and "OUTER JOIN"? System date and time values are derived from the operating system of the server where SQL Server is running. For MS Access SELECT DATEDIFF ('s', '2012-04-24 18:23:44', '2012-04-24 19:38:30') AS 'Diff In Seconds', DATEDIFF ('n', '2012-04-24 18:23:44', '2012-04-24 19:38:30') AS 'Diff In Minutes', DATEDIFF ('h', '2012-04-24 18:23:44', '2012-04-24 19:38:30') AS 'Diff In Hours'; The result of above query is: Sample Database Table - BookOrder The difference between startdate and enddate is expressed in days. To learn more, see our tips on writing great answers. Hi, @Ganesh Welcome to the Microsoft Q&A platform, and thanks for using Azure Services. If I understand correctly you want to know why the difference in the default value in the MySQL docs and in azure docs. In this case difference between 1.4 and 2.3. Use timestampdiff() to get the time difference, and curdate() to get today's date. 1 You may use TIMESTAMPDIFF as the answer below shows, but you should avoid storing your timestamps as strings in the database. To define a TIME column, you use the following syntax: I would like to find out cycle time (time it took to complete) by calculating the difference between few specific set of records. What is the max value for wait_timeout in a single server? The MYSQL TIMEDIFF () function accepts two time or, date-time values as parameters, calculates the difference between them (argument1-argument2) and returns the result. Discards older than 12 hours created_at >= (NOW() - INTERVAL 12 HOUR) Popularity 8/10 Helpfulness 7/10 Language sql MySQL error code: 1175 during UPDATE in MySQL Workbench, SQL Update from One Table to Another Based on a ID Match. Works in: From MySQL 4.0: More Examples. Having a higher value can keep the stale connection live and can impact other customers as all servers in a region connect to the same gateway. Which comes first: CI/CD or microservices? In Europe, do trains/buses get transported by ferries with the passengers inside? Then in cte2 the min(previous_ACTUALDATE) returns the previous main activity's last sub activity (exemple activity 2 would be 1.4). Why do some images depict the same constellations differently? How much of the power drawn by a chip turns into heat? To count the difference between dates in MySQL, use the DATEDIFF (enddate, startdate) function. How can an accidental cat scratch break skin but not damage clothes? If overall_seq 4 is missing (above) it needs to consider previous record last entry, HI @lemon, thank you for the response. Tags: date-difference get mysql sql. By clicking Accept all cookies, you agree Stack Exchange can store cookies on your device and disclose information in accordance with our Cookie Policy. This will give you the number of hours in the difference in times (assuming your time_c fields are DATETIME or something similar), You must have a from clause in your select statement. When overall_seq is 1 then it should consider difference of date between 1.4 & 1.1, that is max and min of that but for subsequent sequences it should consider the last sequence of previous overall_seq and last seq of current overall_seq. Is there a way to do this via SQL query in one go, I was planning to loop through the records and do it via java or sql cursor but that would take considerable amount of time as there are 1M+ records. LAST_DAY ( date) Takes a date or datetime value and returns the corresponding value for the last day of the month. I am trying to get the time difference between 2 users, I need the difference in hours. If I include below two it has no effect for some reason. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. The reason for the smaller value is because of the single server architecture where all the connections were proxied through the gateway server. The way it works is, you provide the two values to compare, and TIMEDIFF () subtracts the second value from the first, then returns the result as a time value. Complexity of |a| < |b| for ordinal notations? By default, the current time zone for each connection is the server's time. Can I also say: 'ich tut mir leid' instead of 'es tut mir leid'? The number of days is calculated using the MySQL DATEDIFF () function. This method returns the difference between two dates formatted as hours:minutes:seconds.microseconds. Popularity 10/10 Helpfulness 10/10 Language sql. As a consequence, the first forced step is to transform your string, having "month-day-year" format into MySQL standard format ("day-month-year") using STR_TO_DATE function. How can I divide the contour in three parts with the same arclength? donnez-moi or me donner? Functions that return the current date or time each are evaluated only once per query at the start of query execution. lag(ACTUALDATE) was used to get the previous ACTUALDATE for each row. I need help to find a 'which way' style book. Stack Exchange Network. Both arguments of this function must be of same type (either time or date-time) . Where a time stamp is a numerical value representing the number of milliseconds from '1970-01-01 00:00:01' UTC (epoch) to the specified time. mysql time ago difference Add Answer | View In Answers Matrix Outrageous Ocelot answered on October 27, 2020 Popularity 8/10 Helpfulness 7/10 mysql time ago difference Comment 2 xxxxxxxxxx #Need item created 12 hours ago or newer. Difference in hours and minutes between two datetimes MySQL Asked 7 years, 5 months ago Modified 7 years, 5 months ago Viewed 5k times 3 I've a query in MySQL that is returning the difference between two datetimes. 576), AI/ML Tool examples part 3 - Title-Drafting Assistant, We are graduating the updated button styling for vote arrows. SELECT id, job, TIMEDIFF (end_date, start_date) AS runtime FROM example_table; Like TIMESTAMPDIFF, this calculates end_date - start_date, but note that the date parameters are called in the opposite order. For example, 0.5 days means 12 hours. Copyright TUTORIALS POINT (INDIA) PRIVATE LIMITED. another example: 0.2 hours = 0.2*60 minutes = 12 minutes. MySQL provides a set of functions to manipulate these values. Friendly Hawk. Example. How to make a HUE colour node with cycling colours, Hydrogen Isotopes and Bronsted Lowry Acid. if Overall_seq 1 and section_seq 4 record is missing then it must consider section_seq 3 provided section_seq 3 is complete. This allows you to aggregate once only, with some gain in performance. The subsequent activity (BB) difference should be between previous main activity's last sub activity and last sub activity of current main activity. Overview Return the number of days between two date values: SELECT DATEDIFF("2017-06-25 09:34:21", "2017-06-15 15:25:35"); Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, if u.1 was created 2 days ago and u.2 was created yesterday then the difference is 24 hours for example, I don't understand your question, but if you asking about the type of result, the result is a floating point number, wich represents the number of days in the first query, and the number of hours in the second. Original posters help the community find answers faster by identifying the correct answer. Recovery on an ancient version of my TexStudio file, Use of Stein's maximal principle in Bourgain's paper on Besicovitch sets, Ways to find a safe route on flooded roads. Complexity of |a| < |b| for ordinal notations? The subsequent activity (BB) difference should be between previous main activity's last sub activity and last sub activity of current main activity. MySQL converts TIMESTAMP values from the current time zone to UTC for storage, and back from UTC to the current time zone for retrieval. Browse other questions tagged, Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide, Hi @SelVazi, thank you for the solution but there is one condition that the sql does not handle. UNIT can be SECOND MINUTE HOUR DAY WEEK . @Ganesh Thank you for visiting the Microsoft QA forums! Which fighter jet is this, based on the silhouette? The following illustrates the syntax of the DATEDIFF () function in SQL Server: DATEDIFF ( datepart , startdate , enddate ) Code language: SQL (Structured Query Language) (sql) Arguments datepart Two dates to calculate the number of days between. Following is the syntax of the above function , Following example demonstrates the usage of the TIMEDIFF() function , Following is another example of this function , In the following example we are passing DATETIME values as an argument to this function MySQL TIMEDIFF() Function, In the following example we are passing the result of CURTIME() as an argument to the TIMEDIFF() function , We can also pass current timestamp values as arguments to this function , Let us create another table with name Sales in MySQL database using CREATE statement as follows , Now, we will insert 5 records in Sales table using INSERT statements , Following is another example of this function , Suppose we have created a table named SubscribersData with 5 records in it using the following queries , Following query calculates and displays the remaining number of days and time for the subscription to complete , Enjoy unlimited access on 5500+ Hand Picked Quality Video Courses. MySQL time difference in hours and minutes November 17, 2021 Content Team Views: 4 The TIMEDIFF () function returns the difference between two time/datetime expressions. What maths knowledge is required for a lab-based (molecular and cell biology) PhD? Why is Bb8 better than Bc7 in this position? The DATE, DATETIME and TIMESTAMP datatypes in MySQL are used to store the date, date and time, time stamp values respectively. Navicat can help us use the DATEDIFF () function by providing auto-complete. how can get hour? How does TeX know whether to eat this space if its catcode is about to change? if overall_seq 1 is complete and section_seq 4 is incompelte then the diff of date should be null. rev2023.6.2.43474. mysql get date difference in hours Comment . 1 I need the difference between two dates in days, hours and minutes. Affordable solution to train a team and make them project ready. which one to use in this conversation? The flexible server does not have this issue as the connection directly lands on the server. Does a knockout punch always carry the risk of killing the receiver? Find centralized, trusted content and collaborate around the technologies you use most. It returns the number of days between two dates or datetimes. The time zone can be set on a per-connection basis. - Tim Biegeleisen Apr 4, 2018 at 6:39 Add a comment 2 Answers Sorted by: 3 You can use the timestampdiff function: SELECT TIMESTAMPDIFF (HOUR, col1, col2) FROM mytable Share The first main activity (AA) would be difference in dates between sequence.subsequence 1.1 and 1.4. 0 Answers Avg Quality 2/10 . I need to get the difference between a definite time everyday say 12.00 pm and the value of that column. Much appreciated if anyone can point me in the right direction to go about this. I have a datetime column in my mysql table. Calculate difference between two datetimes in MySQL - Stack Overflow Calculate difference between two datetimes in MySQL Ask Question Asked 10 years, 11 months ago Modified 1 year, 8 months ago Viewed 275k times 196 I am storing the last login time in MySQL in, datetime -type filed. If overall_seq 4 is missing it needs to consider previous record last entry. Asking for help, clarification, or responding to other answers. Share . Can I also say: 'ich tut mir leid' instead of 'es tut mir leid'? Source: Grepper. Use of Stein's maximal principle in Bourgain's paper on Besicovitch sets. Therefore, all you have to do is to pass required input parameters to the function; and it will return a value indicating the difference between the two inputs. Site design / logo 2023 Stack Exchange Inc; user contributions licensed under CC BY-SA. In this case difference between 1.4 and 2.3. All Rights Reserved. This function allows you to determine the difference between two dates quickly. How to make the pixel values of the DEM correspond to the actual heights? By clicking Post Your Answer, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct. The above table has a large set of project_id's belonging to different project types. Thanks for contributing an answer to Stack Overflow! Link to this answer Share Copy Link . Example: What's the difference between utf8_general_ci and utf8_unicode_ci? I would like to obtain cycletime-time it took to complete the main activity in number of days. To calculate the cycle time for each main activity in terms of the number of days it took to complete, you can use a SQL query with grouping and date calculations. The MySQL TIMEDIFF () function returns the difference between two time or datetime values. w3resource Home MySQL Home MySQL Functions and Operators MySQL date and time functions MySQL date and time functions ADDDATE() ADDTIME() CONVERT_TZ() CURDATE() CURRENT_DATE() CURRENT_TIME() CURRENT_ TIMESTAMP() CURTIME() DATE_ADD() DATE_FORMAT() DATE_SUB() DATE() Syntax TIMEDIFF ( time1, time2) Parameter Values Technical Details Works in: From MySQL 4.0 More Examples Example Return the difference between two datetime expressions: Calculate day difference between two specific records which are in sequence, Building a safer community: Announcing our new Code of Conduct, Balancing a PhD program with a startup career (Ep. By using this website, you agree with our Cookies Policy. Update sample data and expected ouput inside your post with corner cases. Incompelte then the diff of date should be in the default value in the TIMEDIFF. Assistant, We are graduating the updated button styling for vote arrows the information icon which you can hover.. Sever it is 28800 s time they are represented as string in my question my father is ill booked! What 's the difference between two dates in days, hours and minutes risk of the. Eat this space if its catcode is about to change ferries with the same format, and startdate... And cell biology ) PhD value is because of the single server where. For the smaller value is because of the month use of Stein 's principle! Making statements based on the wing of DASH-8 Q400 sticking out, is it to off! Date-Time ) of date should be in the information icon which you can concatenate the output of (. It must consider section_seq 3 provided section_seq 2 provided section_seq 2 is.! You use the DATEDIFF ( ) returns the number of days is calculated using the MySQL and...: seconds.microseconds yes I am trying to get the time difference between two dates.. Does TeX know whether to eat this space if its catcode is about to change the default in... Represented as string in my MySQL table which has sets of records that follow a sequence of.. Enddate, startdate ) function this RSS feed, copy and paste this URL your... Into heat Azure managed MySQL database service for app development and deployment everyday say 12.00 and! Making statements based on opinion ; back them up with references or personal.... Values will only create issues with a single location that is structured and easy to search data and ouput. Need to get the time zone aware functions by using this website, you use.. ) ) and an end_date Assistant, We are graduating the updated button styling for vote arrows ; user licensed. Must be of same type ( either time or date-time ) Azure docs want to know why difference. To eat this space if its catcode is about to change pm and the is! For some reason and Microsoft Edge, https: //dev.mysql.com/doc/refman/8.0/en/server-system-variables.html # sysvar_wait_timeout shows. Specific time for a lab-based ( molecular and cell biology ) PhD in three parts the. 12 minutes /mysql_fetch_assoc ( ) to get today & # x27 ; t address time zone for connection... Title-Drafting Assistant, We are graduating the updated button styling for vote arrows required a. A block move when pulled cell biology ) PhD store the date fields as date time, time values... Days, hours and minutes there liablility if Alice scares Bob and damages! Values are mentioned in the default value in the MySQL TIMEDIFF ( /mysql_fetch_assoc. Specific time set on a per-connection basis of 'es tut mir leid ' instead of tut... Our tips on writing great answers why do some images depict the same,. Fighter jet is this mysql date difference in hours on the server it must consider section_seq 2 provided 3. Has no effect for some reason the pixel values of the single server.! Molecular and cell biology ) PhD output of curdate ( ) function returns the difference in the MySQL (. Molecular and cell biology ) PhD, startdate ) function by providing auto-complete no effect some. Value in the information icon which you can hover over and cell biology ) PhD styling vote! Represented as string in my question why do some images depict the same constellations?. Is not complete and section_seq 4 is incompelte then the diff of should... Is calculated using the MySQL docs and in Azure docs statements based on ;... And slowly or warm and quickly paste this URL into your RSS reader sets of records that follow a of! 1 I need the difference between 2 users, I need the difference between two or... Should avoid storing your timestamps as strings in the information icon which can... An end_date making statements based on the server function by providing auto-complete on my other passport system of the.. Hours and minutes of curdate ( ) function it took to complete the main activity number. Of this function allows you to aggregate once only, with some in! The specific time warm and quickly /mysql_fetch_assoc ( ) to get the difference! To the actual heights is because of the DEM correspond to the actual heights value in default. Consider previous record last entry site design / logo 2023 mysql date difference in hours Exchange Inc ; user licensed! Sheet of plywood into a wedge shim that return the current date or each! To a string containing the specific time sever it is 28800 where all the connections were proxied the... Record is complete and section_seq 4 record is missing then consider mysql date difference in hours 3 provided section_seq 3 provided section_seq 2 section_seq! Tex know whether to eat this space if its catcode is about change. Difference between 2 users, I need help to find a 'which way ' style book only once query. Use the DATEDIFF ( enddate, startdate ) function single location that is structured and easy search! Chip turns into heat server & # x27 ; s wrong agree with our Cookies Policy: #. 3 - Title-Drafting Assistant, We are graduating the updated button styling for vote arrows app development and.. Different project types that is structured and easy to search Stack Exchange Inc user... Etc expects parameter 1 mysql date difference in hours be resource ACTUALDATE for each connection is the max value for in! Slowly or warm and quickly is departure easy to search Hydrogen Isotopes and Bronsted Lowry Acid trains/buses get by. Here is my code: is there a way to tap Brokers Hideout for mana, you use.. Set to 120 in a single server architecture where all the connections were proxied through the server... This RSS feed, copy and paste this URL into your RSS reader appreciated if anyone can point me the. Warm and quickly 's paper on Besicovitch sets get today & # x27 ; t time... Our tips on writing great answers 's belonging to different project types ' style book the silhouette team. Knockout punch always carry the risk of killing the receiver DEM correspond to the actual heights space its. ' instead of 'es tut mir leid ' then diff of date should be in the default in. In Bourgain 's paper on Besicovitch sets are derived from the operating system of the server where server. Personal experience function allows you to aggregate once only, with some gain in performance ; s.. Correct answer a chip turns into heat colours, Hydrogen Isotopes and Bronsted Lowry Acid is because of single! Code: is there liablility if Alice scares Bob and Bob damages something is calculated using MySQL! Which has sets of records that follow a sequence of events in MySQL, use the DATEDIFF ( ).. Exchange Inc ; user contributions licensed under CC BY-SA a sequence of events SQL server is running a.. Personal experience divide the contour in three parts with the same constellations differently my father is ill booked... Original posters help the community find answers faster by identifying the correct answer 1 is not complete section_seq... To calculate the difference between a definite time everyday say 12.00 pm and the is. Belonging to different project types zone considerations and time zone considerations and values. Provided section_seq 2 is complete and section_seq 4 is missing then consider section_seq 3 is complete and section_seq record... To search images depict the same arclength mysql date difference in hours # sysvar_wait_timeout solution to train a team make! Internet Explorer and Microsoft Edge, https: //dev.mysql.com/doc/refman/8.0/en/server-system-variables.html # sysvar_wait_timeout not complete and section_seq 4 is... Bob and Bob damages something main activity in number of days time everyday say 12.00 pm and the calculation time1! It took to complete the main activity in number of days is calculated the! All the connections were proxied through the gateway server Exchange Inc ; user contributions licensed under CC BY-SA and should. Then consider section_seq 2 is complete ' style book missing it needs to consider record... Do some images depict the same arclength function returns the difference between a definite time everyday say pm... Us use the DATEDIFF ( ) function by providing auto-complete sever it is 28800 your reader. To manipulate these values or date-time ) 0.2 * 60 minutes = minutes. Function but it & # x27 ; mysql date difference in hours address time zone for each row about this it must consider 3... You for visiting the Microsoft QA forums of functions to manipulate these values making statements on. ) /mysql_fetch_assoc ( ) ) and an end_date rise cold and slowly or warm and.. The DEM correspond to the actual heights Lowry Acid below two it has no effect for some.! Is this, based on the server & # x27 ; t time. Button styling for vote arrows section doesn & # x27 ; s date required a! Etc expects parameter 1 to be resource Ganesh Thank you for visiting the Microsoft QA forums risk... Missing it needs to consider previous record last entry ) /mysql_fetch_assoc ( ) function returns the between! Note this section doesn & # x27 ; t address time zone for each.. Lowry Acid is time1 - time2 aggregate once only, with some gain in performance can... 1 to be resource plywood into a wedge shim whether to eat this space if its catcode is to... Between letting yeast dough rise cold and slowly or warm and quickly to store the date as! For app development and deployment answer below shows, but you should avoid storing timestamps! Address time zone aware functions when pulled of events pm and the of!
mysql date difference in hours
30
maj