Android Date String Parse getDateFromLJString( String dateString)

Here you can find the source of getDateFromLJString( String dateString)

Description

get Date From LJ String

License

BEER-WARE LICENSE

Declaration

public static HashMap<String, Object> getDateFromLJString(
            String dateString) 

Method Source Code

//package com.java2s;
//License from project: BEER-WARE LICENSE 

import java.util.HashMap;

public class Main {
    public static final String YEAR = "year";
    public static final String MONTH = "mon";
    public static final String DAY = "day";
    public static final String HOUR = "hour";
    public static final String MIN = "min";

    public static HashMap<String, Object> getDateFromLJString(
            String dateString) {//  w  ww .j  a  v  a 2  s .  c  o m
        final HashMap<String, Object> result = new HashMap<String, Object>();

        if (dateString == null || dateString.length() == 0) {
            return result;
        }

        final String[] dateTime = dateString.split(" ");
        final String[] dateItems = dateTime[0].split("-");
        result.put(YEAR, dateItems[0]);
        result.put(MONTH, dateItems[1]);
        result.put(DAY, dateItems[2]);

        final String[] timeItems = dateTime[1].split(":");
        result.put(HOUR, timeItems[0]);
        result.put(MIN, timeItems[1]);

        return result;
    }
}

Related

  1. convertDateStringToDash(String MonthDayYear)
  2. convertDateStringToLong(String date, String format)
  3. convertDateTime( String YearMonthDayHourMinuteSeconds)
  4. convertToDate(String dateString)
  5. getDateFromString(String format, String dateString)
  6. getDateFromString(String dateString)
  7. parseRFC3339Date(String date)
  8. parseRFC822Date(String date)
  9. parseIcalDateToString(Date date, TimeZone tz)