I am returning a class. It returns like that only.
No, you're returning an object. You can't return classes, they're an abstract concept.
What is the actual class of your object? Is it Date? If yes, then use SimpleDateFormat to format it to your liking.
If it's something else, look into the substring() methods of String.