One Line option
This option gets a easy one-line to write the actual date.
Please, note that this is using Calendar.class
and SimpleDateFormat
, and then it's not
logical to use it under Java8.
yourstringdate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(Calendar.getInstance().getTime());