Calculate Full 24-Hour Days Between Two Dates in MySQL

varma
Updated on 28-Jan-2020 10:35:33

289 Views

In DATEDIFF() function only the date parts of the values are used in calculation hence we can use TIMESTAMPDIFF() function to calculate full 24 hour days between two specified dates.For example, if we want to find full 24hour days between ‘2017-05-27 11:59:00’ and 2017-05-23 12:00:00’ then following would be MySQL query −mysql> Select TIMESTAMPDIFF(DAY, '2017-05-23 12:00:00' , '2017-05-27 11:59:00'); +---------------------------------------------------------------------------+ | TIMESTAMPDIFF(DAY, '2017-05-23 12:00:00' , '2017-05-27 11:59:00')         | +---------------------------------------------------------------------------+ | 3                                                                         | +---------------------------------------------------------------------------+ 1 row in set (0.00 sec)

How Microsoft’s Surface Pro 4 and Windows 10 Beat Apple and Google in Productivity

Samual Sam
Updated on 28-Jan-2020 10:34:36

178 Views

The digital world has always been action packed and aggressively competitive since its existence. With exponentially continuous breakthroughs in the world of science and technology, the tech giants like Microsoft, Google, and Apple have been within a perpetual war against each other and the war doesn’t seem to come to an end in the near future.Unlike other kinds of war, whether real or virtual, instead of destructive consequences, this ‘tech-war’ only has constructive consequences bringing an immense amount of productivity for the end users like me and you. This competition in technology has shaped our present and will define our ... Read More

Store Date with Zero Day or Month in MySQL

Nitya Raut
Updated on 28-Jan-2020 10:34:35

337 Views

To store such kind of dates where the day, month or both month & day are zero we must have to set mode of sql to allow_invalid_dates mode.mysql> set sql_mode = 'allow_invalid_dates'; Query OK, 0 rows affected (0.00 sec) mysql> insert into check_date(OrderDate) values('2017-00-00'); Query OK, 1 row affected (0.06 sec) mysql> select * from check_date; +-------------+ | OrderDate | +-------------+ | 2017-00-00 | +-------------+ 1 row in set (0.00 sec)Above query will insert the date in which both month & day values are zero.mysql> insert into check_date(Orderdate) values ('2017-00-05'); Query OK, 1 row affected (0.07 sec) ... Read More

Send File and Parameters within the Same XMLHttpRequest

Jennifer Nicholas
Updated on 28-Jan-2020 10:34:09

497 Views

To send a file and parameters within the same XMLHttpRequest:var myForm = new FormData(); myForm.append('param1', 'demo'); myForm.append('param2', 6767); myForm.append('myDir', 'public-data'); myForm.append('demofile', file); xhr.send(myForm);

Enhance Real-Time Performance on HTML5 Canvas Effects

Samual Sam
Updated on 28-Jan-2020 10:33:37

559 Views

To enhance HTML5 canvas performance:Image smoothing should be disabledRender in half resolutionUse drawImage() to update main canvas You need to use integer coordinates and sizesUsage of requestAnimationFrame() You need to use while loops as often as you can

Unable to Take a Photo from Webcam using HTML5

Lakshmi Srinivas
Updated on 28-Jan-2020 10:32:55

268 Views

You need to try the following to take photo from webcam using HTML5:Declare variablesvar streaming = false,    video = document.querySelector('#video'), canvas = document.querySelector('#canvas'),    photo = document.querySelector('#photo'),    startbutton = document.querySelector('#startbutton'),    width = 320,    height = 0;Using getUserMedianavigator.getMedia = ( navigator.getUserMedia ||                 navigator.webkitGetUserMedia ||                   navigator.mozGetUserMedia ||                    navigator.msGetUserMedia);

Store 0000-00-00 as a Date in MySQL

Anvi Jain
Updated on 28-Jan-2020 10:31:35

2K+ Views

For storing the date like ‘0000-00-00’ in a column of MySQL table, we must have to set the SQL mode to ‘allow_invalid_date’. Following example will demonstrate it −mysql> SET sql_mode = 'allow_invalid_dates'; Query OK, 0 rows affected, 1 warning (0.03 sec) mysql> Create table test_date(date_order date); Query OK, 0 rows affected (0.45 sec) mysql> Insert into test_date(date_order) values('0000-00-00'); Query OK, 1 row affected (0.04 sec) mysql> Select * from test_date; +------------+ | date_order | +------------+ | 0000-00-00 | +------------+ 1 row in set (0.00 sec)

How Addiction for Pokémon Affected Many in a Short Span

Samual Sam
Updated on 28-Jan-2020 10:30:40

171 Views

You see them here, there, on the pathways, on the streets, across bridges, inside parks, inside shopping malls between buildings, behind parking lots, and basically anywhere outdoors imaginable. It seems as if the world has been invaded by a huge fleet of ‘Pokemon Go Zombies’ or more generally called ‘Pokemon-goers’.What’s all the Fuss about?Despite mixed reviews and a tad bit of criticism from game critics, Pokemon Go has become quite a phenomenon since its release on the 6th of July, 2016. It is basically a game that makes the use of the GPS and the Camera of any Android or ... Read More

Create Your Own Choice MySQL Database

Anjana
Updated on 28-Jan-2020 10:28:48

170 Views

CREATE DATABASE db_name can be used to create our own choice MySQL database. For example to create a database named Sample, we should have to run the command as follows −mysql> CREATE DATABASE Sample; Query OK, 1 row affected (0.04 sec)

Nokia 3310: Relevance in Today's Smartphone Era

Samual Sam
Updated on 28-Jan-2020 10:26:07

238 Views

Every time your smartphone troubles you all you could think of is the time when things were so simple back. I mean – Yes I like smartphones where you carry a complete package of entertainment, news, and necessity with you. Never to forget the self-camera, apps like WhatsApp, Instagram and Snapchat makes it’s more irresistible. Still being unsatisfied humans we still want more battery backup, better performance, and minimal hanging.In short, we want a merger of our previous type based phone with our new smartphones. Remember the era when mobile phones were first launched? Nokia was the best option we ... Read More

Advertisements