382
382
drop table t1,t2,t3;
383
383
select @a:=FROM_UNIXTIME(1);
384
384
@a:=FROM_UNIXTIME(1)
386
386
select unix_timestamp(@a);
387
387
unix_timestamp(@a)
389
select unix_timestamp('1969-12-01 19:00:01');
390
unix_timestamp('1969-12-01 19:00:01')
389
select unix_timestamp('1970-01-01 00:00:01');
390
unix_timestamp('1970-01-01 00:00:01')
392
392
select from_unixtime(-1);
393
393
from_unixtime(-1)
395
395
select from_unixtime(2147483647);
396
396
from_unixtime(2147483647)
398
398
select from_unixtime(2147483648);
399
399
from_unixtime(2147483648)
401
401
select from_unixtime(0);
404
404
select unix_timestamp(from_unixtime(2147483647));
405
405
unix_timestamp(from_unixtime(2147483647))
408
408
unix_timestamp(from_unixtime(2147483648))
410
410
select unix_timestamp('2039-01-20 01:00:00');
411
unix_timestamp('2039-01-20 01:00:00')
411
ERROR HY000: Received an invalid value '2039-01-20 01:00:00' for a UNIX timestamp.
413
412
select unix_timestamp('1968-01-20 01:00:00');
414
unix_timestamp('1968-01-20 01:00:00')
413
ERROR HY000: Received an invalid value '1968-01-20 01:00:00' for a UNIX timestamp.
416
414
select unix_timestamp('2038-02-10 01:00:00');
417
unix_timestamp('2038-02-10 01:00:00')
415
ERROR HY000: Received an invalid value '2038-02-10 01:00:00' for a UNIX timestamp.
419
416
select unix_timestamp('1969-11-20 01:00:00');
420
unix_timestamp('1969-11-20 01:00:00')
417
ERROR HY000: Received an invalid value '1969-11-20 01:00:00' for a UNIX timestamp.
422
418
select unix_timestamp('2038-01-20 01:00:00');
423
unix_timestamp('2038-01-20 01:00:00')
419
ERROR HY000: Received an invalid value '2038-01-20 01:00:00' for a UNIX timestamp.
425
420
select unix_timestamp('1969-12-30 01:00:00');
426
unix_timestamp('1969-12-30 01:00:00')
421
ERROR HY000: Received an invalid value '1969-12-30 01:00:00' for a UNIX timestamp.
428
422
select unix_timestamp('2038-01-17 12:00:00');
429
423
unix_timestamp('2038-01-17 12:00:00')
431
select unix_timestamp('1970-01-01 03:00:01');
432
unix_timestamp('1970-01-01 03:00:01')
434
select unix_timestamp('2038-01-19 07:14:07');
435
unix_timestamp('2038-01-19 07:14:07')
425
select unix_timestamp('2038-01-19 03:14:07');
426
unix_timestamp('2038-01-19 03:14:07')
437
428
CREATE TABLE t1 (datetime datetime, timestamp timestamp, date date);
438
429
INSERT INTO t1 values ("2001-01-02 03:04:05", "2002-01-02 03:04:05", "2003-01-02");
439
430
SELECT * from t1;
666
657
select last_day("1997-12-1")+0.0;
667
658
last_day("1997-12-1")+0.0
669
select strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0;
670
strcmp(date_sub(localtimestamp(), interval 3 hour), utc_timestamp())=0
660
select strcmp(date_sub(localtimestamp(), interval 0 hour), utc_timestamp())=0;
661
strcmp(date_sub(localtimestamp(), interval 0 hour), utc_timestamp())=0
672
select strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0;
673
strcmp(date_format(date_sub(localtimestamp(), interval 3 hour),"%Y-%m-%d"), utc_date())=0
663
select strcmp(date_format(date_sub(localtimestamp(), interval 0 hour),"%Y-%m-%d"), utc_date())=0;
664
strcmp(date_format(date_sub(localtimestamp(), interval 0 hour),"%Y-%m-%d"), utc_date())=0
675
666
select strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0;
676
667
strcmp(date_format(utc_timestamp(),"%Y-%m-%d"), utc_date())=0