473,404 Members | 2,170 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

Could someone explain this to me?

alt
UNIX_TIMESTAMP()
UNIX_TIMESTAMP(date)

If called with no argument, returns a Unix timestamp (seconds since
'1970-01-01 00:00:00' GMT) as an unsigned integer. If UNIX_TIMESTAMP() is
called with a date argument, it returns the value of the argument as
seconds since '1970-01-01 00:00:00' GMT. date may be a DATE string, a
DATETIME string, a TIMESTAMP, or a number in the format YYMMDD or YYYYMMDD
in local time.

mysql> SELECT UNIX_TIMESTAMP();
-> 882226357
mysql> SELECT UNIX_TIMESTAMP('1997-10-04 22:23:00');
-> 875996580

When UNIX_TIMESTAMP is used on a TIMESTAMP column, the function returns
the internal timestamp value directly, with no implicit
``string-to-Unix-timestamp'' conversion. If you pass an out-of-range date
to UNIX_TIMESTAMP(), it returns 0, but please note that only basic range
checking is performed (year from 1970 to 2037, month from 01 to 12, day
from 01 from 31). If you want to subtract UNIX_TIMESTAMP() columns, you
might want to cast the result to signed integers. See section 13.7 Cast
Functions.
I'm specifically interested in why this behaviour was decided upon:

When UNIX_TIMESTAMP is used on a TIMESTAMP column, the function returns the
internal timestamp value directly, with no implicit
``string-to-Unix-timestamp'' conversion.

Is it just me or is MySQL lacking a timestamp-to-unixtimestamp conversion?

--
Donovan Hill
Linux User, Canadian.... All around nice guy!

All email to the reply-to address above will automatically put your IP in a
blocklist and qualify you for a free security audit.
Jul 20 '05 #1
0 1334

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: C++fan | last post by:
The following code is for list operation. But I can not understand. Could anyone explain the code for me? /* * List definitions. */ #define LIST_HEAD(name, type) struct name { type...
21
by: Gactimus | last post by:
Can anyone explain what the lines with the '*' by them do? ----------- #ifndef _COUNTER_H #define _COUNTER_H #include <iostream> using namespace std; class Counter
3
by: MarcJessome | last post by:
Hi, I was wondering if someone could help me through learning C++. I've tried learning before, but I find I would work better if I had someone that could help explain a few things to me. Im using...
8
by: Bart | last post by:
Could someone explain me what is wrong with this code ? I gives me a compile error: Error 1 Use of unassigned local variable 'fileStreamObject' C:\Documents and Settings\Bart\Local...
8
by: CalebConnolly | last post by:
Hi, ive been reading these forums for a while and just now after reading something that makes no sense to me I thought I might as well ask on here for some help. Basically I was reading through a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.