Hive date format -
anybody converted date mm/dd/yyyy hh:mm format yyyy-mm-dd hh:mm:ss format using hive query ?
i have string date in / format need add duration in it
do this:
select regexp_replace('2015/04/15','(\\d{4})\\/{1}(\\d{2})\\/{1}(\\d{2})','$1-$2-$3') dt x; input:2015/04/05 output:2015-04-05
grab 4 numeric digits (\d{4}), 2 (\d{2}), , 2 more (\d{2}) original string , put them in order seperated dashes.
Comments
Post a Comment