Error to create new type Date

I'm using the following convention and in date I get that method is deprecated (there is line that delete the date) there is saw this message Deprecated. As of JDK version 1.1, replaced by DateFormat.parse(String s).

how should i use it in the following code?

else if (typeName.equals("String")) {
    return new SwitchInputType<String>(new String("String test"));
}
else if (typeName.equals("Date")) {
    return new SwitchInputType<Date>(new -Date-("13:20:00"));   
} 

the problem is with the (new Date("13:20:00"));

when i try to replace it with

return new SwitchInputType<DateFormat>(new DateFormat("13:20:00"));

i got the following message :

Cannot instantiate the type DateFormat

how should I handle it?

Answers


DateFormat is an abstract class so it cannot be instantiated. Instantiate a SimpleDateFormat instead or use the static methods in DateFormat like getDateInstance() or getTimeInstance().


Need Your Help

Identifying information about executable

c++ executable decompiling

I have a Linux executable that seems to have been written in C++ using a GNU compiler, and in debug mode. I'd like to know if my conclusion is correct and what are my chances of decompiling it into

Google App Scripts for Documents: insert text and add it to a named range for later retrieval

google-apps-script google-docs

I am trying to write a Google Apps Script for Documents that will insert some text, and then add inserted text to a named ranged. To make sure that the inserted text is saved to a named range, I just

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.