Why Output is Zero When Converting Date to TIMESTAMP

mkotla
Updated on 28-Jan-2020 10:50:53

377 Views

As we know that with the help of MySQL UNIX_TIMESTAMP function, we can produce the number of seconds from given date/DateTime. But when we try to convert a date like ‘1965-05-15’ it would give 0(Zero) as output because the range of TIMESTAMP is between ‘1970-01-01 00:00:01’ to ‘2038-01-19 08:44:07’. Hence, the date values beyond TIMESTAMP range cannot be converted and will return 0 as output always.Examples are given below −mysql> Select UNIX_TIMESTAMP ('1965-05-15'); +----------------------------------------------+ | unix_timestamp('1965-05-15 05:04:30')        | +----------------------------------------------+ |                                   ... Read More

How Google Earth VR Makes Virtual Travel a Reality

Samual Sam
Updated on 28-Jan-2020 10:48:04

306 Views

How it would feel like if you were to stand on the top of Burj Khalifa or to view the beautiful Taj Mahal from a bit closer or to fly over the Great Wall of China, live just by sitting on your couch? Well, a virtual reality (VR) based application of Google can do that for you.This technology sounds much similar to some earlier applications of Google where one can make a virtual tour just by sitting at home. Yes but they cannot let you see the on road trees and other objects with a clarity that Google VR does ... Read More

Convert Seconds to TIMESTAMP in MySQL

Sravani S
Updated on 28-Jan-2020 10:44:24

1K+ Views

It is exactly reverse of UNIX_TIMESTAMP() and can be done with the help of FROM_UNIXTIME() function. For example, 11576070 seconds would be TIMESTAMP ‘1970-05-15 05:04:30’.mysql> Select FROM_UNIXTIME(11576070); +--------------------------------+ | FROM_UNIXTIME(11576070)        | +--------------------------------+ |      1970-05-15 05:04:30       | +--------------------------------+ 1 row in set (0.00 sec)

Starting Range of TIMESTAMP Data Type in MySQL

radhakrishna
Updated on 28-Jan-2020 10:43:55

176 Views

As we know that this function converts a number of seconds into TIMESTAMP value. So by providing 0 seconds as the argument, it will give us the starting range of TIMESTAMP data type.mysql> Select FROM_UNIXTIME(0); +-------------------------+ | FROM_UNIXTIME(0)        | +-------------------------+ | 1970-01-01 05:30:00     | +-------------------------+ 1 row in set (0.00 sec)Now if we will change the argument from 0 to 60 seconds then the time will be changed by 01 minutes.mysql> Select FROM_UNIXTIME(60); +-------------------------+ | FROM_UNIXTIME(60)       | +-------------------------+ | 1970-01-01 05:31:00     | +-------------------------+ 1 row in set (0.00 sec)

Reduce Update Cycles and Fragmentation in Android

Samual Sam
Updated on 28-Jan-2020 10:43:18

166 Views

Every time a new app is launched or say a new version of existing app is launched, our Android smartphone gives us the notification, New updates are available or updated your phone etc. For any techie, developer or mobile lover it is the most beautiful feeling. They are too excited to try the new version.But for the rest of us, we are like why we don’t need any update or I am too lazy for all these things. But that’s the case we can’t help, so either we update and enjoy we features with of course some faults, missing our ... Read More

Comparison Operator with Date Values in MySQL

vanithasree
Updated on 28-Jan-2020 10:41:23

218 Views

Comparison operator between dates will work in a logical way. In the following example, while comparing two dates, MySQL is simply comparing two numbers or string −mysql> select 20171027 < 20150825; +---------------------------+ | 20171027 < 20150825       | +---------------------------+ |                      0    | +---------------------------+ 1 row in set (0.00 sec)The 0 output shows that the result of the above query is FALSE.mysql> select 20171027 > 20150825; +--------------------------+ | 20171027 > 20150825      | +--------------------------+ |                      1   | +--------------------------+ 1 row in set (0.00 sec)The output ‘1’ shows that the result of the above query is TRUE.

MySQL Operators with Date Represented as String

Govinda Sai
Updated on 28-Jan-2020 10:40:17

243 Views

Such kind of calculations can cause unpredictable result because when the date is represented as MySQL string then MySQL tries to perform numeric operations on a string by taking only the first that appears. Following examples will clarify it −mysql> select '2017-10-17' + 20; +-------------------+ | '2017-10-17' + 20 | +-------------------+ |      2037         | +-------------------+ 1 row in set, 1 warning (0.00 sec) mysql> select '2017-10-25' - 17; +-------------------+ | '2017-10-25' - 17 | +-------------------+ |              2000 | +-------------------+ 1 row in set, 1 warning (0.00 sec) ... Read More

Display MySQL Database That Is Currently In Use

Alankritha Ammu
Updated on 28-Jan-2020 10:38:56

122 Views

We can display the name of MySQL database that is currently in use by Select Database() command.mysql> select database(); +------------+ | database() | +------------+ | tutorial   | +------------+ 1 row in set (0.00 sec)This command shows that we currently use tutorial database.

Check Statement for Creating a Particular MySQL Database

Swarali Sree
Updated on 28-Jan-2020 10:38:25

158 Views

With the help of CREATE DATABASE db-name command, we can check the statement of creating any MySQL database.mysql> SHOW CREATE DATABASE Sample; +----------+-------------------------------------------------------------------+ | Database | Create Database                                                   | +----------+-------------------------------------------------------------------+ | sample   | CREATE DATABASE `sample` /*!40100 DEFAULT CHARACTER SET latin1 */ | +----------+-------------------------------------------------------------------+ 1 row in set (0.00 sec)The output shows how MySQL database named Sample has been created.

How IoT Impacts Big Data

Samual Sam
Updated on 28-Jan-2020 10:38:05

561 Views

When it comes to two of the most talked about technologies in present times, Big Data and Internet of Things (IoT) are perhaps right at the helm. And over the last few years, Big Data has made progress in numerous domains. And although Internet of Things happens to be different, it is massively linked to Big Data.What is Big Data?Big Data is essentially a large amount of data that is in complex form. Specifically, it also refers to the use of predictive analysis and methods that allows extraction of valuable information from such data. This allows better decision making, reduction ... Read More

Advertisements