-1

I have a string that contains date in this format"2014-07-23T00:00:00-07:00" I need to get the date part of it as output. any of the formats dd-mm-yyyy, mm-dd-yyyy... etc

Ankith
  • 145
  • 2
  • 12

2 Answers2

2

Try a substring function to get the string you want.

for example:

if you want "2014-07-23"

try:

 substring(1,10)
raja121
  • 1,129
  • 2
  • 8
  • 16
1

try:

String dateTime = "2014-07-23T00:00:00-07:00";
String date = dateTime.split("T")[0];

date will now be "2014-07-23"

fires
  • 38
  • 4