Questions tagged [timestampdiff]

56 questions
0
votes
1 answer

MySQL Count time between 2 dates with multiple rows of data

I have a table which contains 2 columns date_picked_begin and date_picked and there will be multiple rows which contain a date in each. How do I use TIMESTAMPDIFF to get the difference in seconds between the dates in all rows of data. I have tried…
Dan
  • 103
  • 1
  • 13
0
votes
2 answers

PHP/MySQL trying to get TIMESTAMPDIFF to output a result

My intention with the below code is display the difference between two timestamps in seconds, but nothing is showing at all. I´ve added echo $ts for you to see what $ts contains: $ts = $value['time']; echo $ts; $sql = "SELECT…
Corey Hart
  • 173
  • 1
  • 2
  • 15
0
votes
1 answer

TIMESTAMPDIFF - How to use it in PHP/MySQL to calculate difference between date values

TIMESTAMPDIFF The link above have helped me how to calculate difference in two dates, however, I need to do the same on a particular column at run time via MySQL select query inside PHP. For example: Profile table: Name Gender DOB (Date of…
Kam
  • 13
  • 4
0
votes
1 answer

Calculate the exact time difference using moment JS

I need to calculate the exact time diffrence using moment JS . My JS code is : var a = moment(from_url); a.format('DD/MM/YYYY hh:mm:ss'); var b = moment(to_url); b.format('DD/MM/YYYY hh:mm:ss'); …
0
votes
2 answers

Get time difference between two different dates with timestamp?

I have four fields in my HTML. Two are datepicker fields (one for from-date the other for the to-date). Similarly, the other two are timepicker fields (one for the from-time and other for the to-time) .
0
votes
2 answers

MySQL Date Difference Query

I am trying to write an extensive query that will accomplish the following tasks; Select the fields "time_stamp" and "status" from the "time_stamps" DB and order them by "time_stamp" ASC. Of the fields returned, for each pair of time stamps (1 in…
Kronos1
  • 3
  • 4
0
votes
1 answer

SQL - condition on a timestampdiff

I would like to get the average time of solution time for tickets from state 'billet ouvert' to state 'résolu'. Table Sample The queries I tried: Query 1: SELECT title AS 'Etat', ticket_id, user_id, AVG(TIMESTAMPDIFF(HOUR, …
avocado15
  • 1
  • 2
0
votes
3 answers

TIMESTAMPDIFF not working on mysql query in codeigniter

So basically I have a TIMESTAMPDIFF query in my model to determine the duration and I want it to display the duration in a view. The problem is, it will display the error. Please help me, thank you. Here's my query of my model…
Jorge
  • 23
  • 3
  • 12
-1
votes
2 answers

How can I calculate the difference in Minutes between 2 Timestamp-variables in BigQuery? (Standard SQL)

I have 2 columns started_at and ended_at (both timestamps) and try to calculate the exact difference in minutes, but somehow it dont wanna work. I've already looked for similar questions but it doesnt work for…
Onur
  • 35
  • 6
-1
votes
1 answer

Can i get a time difference in minutes for subsequent rows in mysql using timestamp

`ID`,`NAMES`, `TIMESTAMP` '3', 'Sharon', '2020-02-17 21:11:12' '4', 'RALPH', '2020-02-18 01:50:19' Above is an extraction from my table.I would want to find time difference between the two timestamps(i.e for ID=3 and ID=4). Also i would like…
-1
votes
2 answers

Calculate average number of years with TIMESTAMPDIFF

I need to calculate the average number of years from my MySQL database, and I try to use TIMESTAMPDIFF Which one gives a valid result: AVG( TIMESTAMPDIFF(MONTH, tanggal_masuk, tanggal_yudisium )/12 ) or AVG( TIMESTAMPDIFF(YEAR, tanggal_masuk,…
Sofyan Thayf
  • 1,322
  • 2
  • 14
  • 26
1 2 3
4