[ 
https://issues.apache.org/jira/browse/HADOOP-18952?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17780014#comment-17780014
 ] 

Viraj Jasani commented on HADOOP-18952:
---------------------------------------

This has been the case since the beginning:

Stat:
{code:java}
protected final SimpleDateFormat timeFmt;
{
  timeFmt = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  timeFmt.setTimeZone(TimeZone.getTimeZone("UTC"));
}{code}
Ls:
{code:java}
protected final SimpleDateFormat dateFormat =
  new SimpleDateFormat("yyyy-MM-dd HH:mm"); {code}

> FsCommand Stat class set the timeZone"UTC", which is different from the 
> machine's timeZone
> ------------------------------------------------------------------------------------------
>
>                 Key: HADOOP-18952
>                 URL: https://issues.apache.org/jira/browse/HADOOP-18952
>             Project: Hadoop Common
>          Issue Type: Bug
>         Environment: Using Hadoop 3.3.4-release
>            Reporter: liang yu
>            Priority: Major
>         Attachments: image-2023-10-26-10-07-11-637.png
>
>
> Using Hadoop version 3.3.4
>  
> When executing Ls command and Stat command on the same hadoop file, I get two 
> timestamps.
>  
> {code:java}
> hdfs dfs -stat "modify_time %y, access_time%x" /path/to/file{code}
>  returns:
> modify_time {_}*2023-10-17 01:43:05*{_}, access_time _*2023-10-17 01:41:00*_ 
>  
> {code:java}
> hdfs dfs -ls /path/to/file{code}
>   returns:
> {-}rw{-}rw-r–+     3    user_name     user_group     247400339     
> _*2023-10-17 09:43*_     /path/to/file
>  
> these two timestamps has the difference 8hours.
> I am in China, the timezone is “UTC+8”, so the timestamp from LS command is 
> correct and timestamp from STAT command is wrong.
>  
> !image-2023-10-26-10-07-11-637.png!
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: common-issues-h...@hadoop.apache.org

Reply via email to