Untitled

 avatar
unknown
plain_text
2 years ago
514 B
7
Indexable
String date_string = "Sun Oct 30 16:37:10 GMT 2022";
        try{
            date = new SimpleDateFormat("yy-MM-dd hh:mm", Locale.getDefault()).parse(date_string);
        }
        catch (ParseException e){
            System.out.println(e.getMessage());
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);

        System.out.println("day of year: " + cal.get(Calendar.DAY_OF_YEAR)
        + "\n day of month: " + cal.get(Calendar.DAY_OF_MONTH)
        + "\n etc..");
Editor is loading...