Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. --start of the day, no tz
  2. select to_timestamp_ntz('2019-05-18');
  3. --2019-05-18 00:00:00.000000000
  4.  
  5. --!! uses system time
  6. select to_timestamp_tz('2019-05-18');
  7. --2019-05-18 00:00:00.000000000 -07:00
  8.  
  9. --!! does nothing
  10. select CONVERT_TIMEZONE('UTC','UTC', to_timestamp_ntz('2019-05-18'));
  11. --2019-05-18 00:00:00.000000000
  12.  
  13. select CONVERT_TIMEZONE('UTC', to_timestamp_tz('2019-05-18'));
  14.  
  15. --!! assumes system time, and casts to timestamp_tz
  16. select CONVERT_TIMEZONE('UTC', CONVERT_TIMEZONE('UTC','UTC', to_timestamp_ntz('2019-05-18')));
  17. --2019-05-18 07:00:00.000000000 +00:00
  18.  
  19. -- works as expected, but still has no timezone
  20. select CONVERT_TIMEZONE('UTC', 'America/Los_Angeles', to_timestamp_ntz('2019-05-18'));
  21.  
  22. -- seems to add the timezone
  23. select CONVERT_TIMEZONE('UTC', to_timestamp_ntz('2019-05-18') || ' +0:00');
  24. -- 2019-05-18 00:00:00.000000000 +00:00
  25.  
  26. -- works
  27. select CONVERT_TIMEZONE('America/Los_Angeles', to_timestamp_ntz('2019-05-18') || ' +0:00');
  28. -- 2019-05-17 17:00:00.000000000 -07:00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement