There are functions for day (called dayOfMonth and dayOfYear) and hour (called hour). You can view them here: https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.functions
Example: import org.apache.spark.sql.functions._ val df = df.select(hour($"myDateColumn"), dayOfMonth($"myDateColumn"), dayOfYear($"myDateColumn")) 2017-11-09 12:05 GMT+01:00 David Hodefi <davidhodeffi.w...@gmail.com>: > I would like to truncate date to his day or hour. currently it is only > possible to truncate MONTH or YEAR. > 1.How can achieve that? > 2.Is there any pull request about this issue? > 3.If there is not any open pull request about this issue, what are the > implications that I should be aware of when coding /contributing it as a > pull request? > > Last question is, Looking at DateTImeUtils class code, it seems like > implementation is not using any open library for handling dates i.e > apache-common , Why implementing it instead of reusing open source? > > Thanks David > -- Gaspar Muñoz Soria Vía de las dos Castillas, 33, Ática 4, 3ª Planta 28224 Pozuelo de Alarcón, Madrid Tel: +34 91 828 6473