Search code examples
hadoophadoop2

Difference between the date returned by hadoop fs -ls and hadoop fs -stat


Is there any difference between the dates returned by

hadoop fs -ls myfile

and

hadoop fs -stat myfile

Solution

  • Although by default both will display modification time, -stat shows time in UTC while -ls converts it to local timezone and drops seconds. From Hadoop file system shell doc:

    stat
    Usage: hadoop fs -stat [format] path
    ... %x and %y show UTC date as “yyyy-MM-dd HH:mm:ss”