My webservice requires an input parameter of datetime of this format : yyyy-mm-dd-hh.mm.ss.fff. I tried this:
Datetime myDT = Datetime.now();
String myDate = myDT.format('yyyy-mm-dd-hh.mm.ss.fff');
says the format is not recognized. How do I create a date time in this format?
Thanks.
yyyy-MM-dd-hh.mm.ss.SSS
? Capital M is for month and lower case is for minute. Also capital S is for milliseconds. The letters are listed herehh
will display the hours in 12 hour format andHH
will display it in 24 hour format.HH
might be what you are looking to use if you are using this format to create a unique string.