string - Java - store current date WITHOUT TIME into a Text file -


this question has answer here:

i need help. have searched , tried every example use, none have worked.

i need store current date in yyyy-mm-dd format in text file..the string date has string..

string datef = "yyyy-mm-dd"; date dateonly = new date(); simpledateformat dateformat = new simpledateformat(datef); string date = dateformat.format(dateonly); 

when tried code above.. output got

please|work|2016-04-110|11 

please me...this assignment due friday ): need date , 2 other things done.. :)

format being used incorrect.

yyyy-mm-dd : capital dd return day in year. so, 11 april corresponds 110th day in year.

yyyy-mm-dd : small dd return day in month.

refer: https://docs.oracle.com/javase/7/docs/api/java/text/simpledateformat.html


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -