java - how return an output type date in web services? any solution -


i try return output (type date ) in web service receive weird result

@webmethod  public date testdate(string arg) throws parseexception{     system.out.println(arg);      simpledateformat sdf = new simpledateformat(arg);     date dat = sdf.parse(arg);     system.out.println("date");      system.out.println(dat);     return dat; } 

this input 16/08/2013 11:05:03 receive output

<return>1970-01-01t00:00:00+01:00</return> 

expected output should contain "16/08/2013 11:05:03".

the problem using string date "arg" create format, in constructor of format must put format

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

public static void main(string[] args) { date = new date(); string datestring = now.tostring(); system.out.println(" 1. " + datestring); simpledateformat format = new simpledateformat("eee mmm dd hh:mm:ss zzz yyyy"); system.out.println(" 3. " + format.format(now)); } 1.    mon aug 06 11:12:00 art 2012 3.    mon ago 06 11:12:00 art 2012 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -