Share

Search Java Code Snippets


  Help us in improving the repository. Add new snippets through 'Submit Code Snippet ' link.





#Java - Code Snippets for '#Java.text.SimpleDateFormat' - 3 code snippet(s) found

 Sample 1. Initialize Date using SimpleDateFormat and parsing string

Date endDate = new SimpleDateFormat("yyyyMMdd").parse("20160426");

   Like      Feedback     SimpleDateFormat   Date   SimpleDateFormat.parse  java.text.SimpleDateFormat


 Sample 2. Parse JSON using JSONParser

JSONParser jsonParser = new JSONParser();
String jsonMessage = JSONMessageAsString;

JSONObject jsonObject = null;
try {
jsonObject = (JSONObject) jsonParser.parse(jsonMessage);
} catch (ParseException e) {
System.out.println("Error in Parsing JSON");
}


Long id = (Long) jsonObject.get("Id");
String name = (String) jsonObject.get("Name");

   Like      Feedback     JSON Parsing  JSON Parser


 Sample 3. Code Sample / Example / Snippet of java.text.SimpleDateFormat

    private static String getNameOrAbbrev(String format)

{

Calendar cal = Calendar.getInstance();

SimpleDateFormat dateFormat = new SimpleDateFormat(format, Locale.ENGLISH);

return dateFormat.format(cal.getTime());

}


   Like      Feedback      java.text.SimpleDateFormat



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner



comments powered by Disqus