-1

I am trying to writing sql in sqlite3 but somehow it is not passing the result . I tried this :

select datetime ('2019-04-01 12:20',time('+2 hours'));

or

select time ('2019-04-01 12:20','+2 hours');

or

select date ('2019-04-01','YYYY-MM-DD HH:MM',time('+2 hours'));

any suggestions will be appreciated.

zealous
  • 7,336
  • 4
  • 16
  • 36
ngage49
  • 19
  • 1
  • 4

3 Answers3

0

You should try to add minutes as following

select DATETIME('2019-04-01 12:20', '+120 minutes') as newTime;

or

select DATETIME('2019-04-01 12:20', '+2 hours') as newTime;

output:

| newTime             |
| ------------------- |
| 2019-04-01 14:20:00 |
zealous
  • 7,336
  • 4
  • 16
  • 36
0

You just need datetime() function with modifier containing hours such as

select datetime ('2019-04-01 12:20','+2 hours');
Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
0

You can do like below:

SELECT time('2019-04-01','+2 hours');

samthegolden
  • 1,366
  • 1
  • 10
  • 26