Reputation: 749
I want to pass time-stamp in the "yyyy-mm-dd hh:mm:ss" format using shell Script, I mean from shell script I will call my jar file and pass the parameters as argument, so I am doing like as -
DATE=`date +%Y-%m-%d" "%H:%M:%S`
spark-submit --jars ./mylibs/log4j-1.2.17.jar --class com.mycom.test.jobtest.agg myApp-.0.1.jar $DATE
if I take echo of DATE it will give the proper date as expected format "yyyy-mm-dd hh:mm:ss" but while parsing in java it is considering space and taking only date part, and giving error as under-
Exception in thread "main" java.text.ParseException: Unparseable date: "2015-03-08"
Please suggest best way to pass time-stamp as argument,
Upvotes: 2
Views: 1674