starrocks icon indicating copy to clipboard operation
starrocks copied to clipboard

from_unixtime function return error results when using different format

Open zhangyifan27 opened this issue 1 year ago • 2 comments

Steps to reproduce the behavior (Required)

select from_unixtime(1727193600, 'yyyy-MM-dd HH:mm');

Expected behavior (Required)

select from_unixtime(1727193600, '%Y-%m-%d %H:%i');
+---------------------------------------------+
| from_unixtime(1727193600, '%Y-%m-%d %H:%i') |
+---------------------------------------------+
| 2024-09-25 00:00                            |
+---------------------------------------------+

Real behavior (Required)

select from_unixtime(1727193600, 'yyyy-MM-dd HH:mm');
+-----------------------------------------------+
| from_unixtime(1727193600, 'yyyy-MM-dd HH:mm') |
+-----------------------------------------------+
| yyyy-MM-dd HH:mm                              |
+-----------------------------------------------+

StarRocks version (Required)

  • You can get the StarRocks version by executing SQL select current_version()

3.3

zhangyifan27 avatar Oct 21 '24 08:10 zhangyifan27

@zhangyifan27 most probably it seems you have not configured the correct time zone, so you are seeing incorrect result.

rohitrs1983 avatar Oct 21 '24 09:10 rohitrs1983

@zhangyifan27 most probably it seems you have not configured the correct time zone, so you are seeing incorrect result.

@rohitrs1983 When I changed the format string, second parameter of the function from_unixtime, the result is not expected. It returned the format string instead of the time string. I think it should be an implementation bug.

zhangyifan27 avatar Oct 21 '24 10:10 zhangyifan27

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!

github-actions[bot] avatar Apr 21 '25 11:04 github-actions[bot]