Can I change Mysql current time CURTIME() in query for testing purposes? -


i have unit test, , want curtime() return same time, can somehow ?

i can set timezone:

set time_zone = 'america/new_york'; select curtime(); 

but there way set time ?

part of query is:

(curtime() between time(convert_tz(opening_time, timezone, "utc")) , time(convert_tz(closing_time, timezone, "utc"))) 

i want test more timezones , different times

curtime() based on server timezone, way make change directly changing server timezone:

set time_zone = 'france/paris'; 

in debugging purposes, use @juergend idea use static time string make tests.

edit: didn't read well, knew part. still, don't understand why don't use static time string in query, no matter how many times have in query

 ('12:34:56' between time(convert_tz(opening_time, timezone, "utc")) , time(convert_tz(closing_time, timezone, "utc"))) 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -