Java Code Examples for java.util.Locale#PRC

The following examples show how to use java.util.Locale#PRC . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: a   File: DateUtils.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * 将yyyy-MM-dd HH:mm:ss字符串转换成日期<br/>
 *
 * @param dateStr    时间字符串
 * @param dataFormat 当前时间字符串的格式。
 * @return Date 日期 ,转换异常时返回null。
 */
public static Date parseDate(String dateStr, String dataFormat) {
    try {
        SimpleDateFormat dateFormat = new SimpleDateFormat(dataFormat, Locale.PRC);
        Date date = dateFormat.parse(dateStr);
        return new Date(date.getTime());
    } catch (ParseException e) {
        return null;
    }
}
 
Example 2
Source Project: FilePicker   File: DateUtils.java    License: MIT License 5 votes vote down vote up
/**
 * 将yyyy-MM-dd HH:mm:ss字符串转换成日期<br/>
 *
 * @param dateStr    时间字符串
 * @param dataFormat 当前时间字符串的格式。
 * @return Date 日期 ,转换异常时返回null。
 */
public static Date parseDate(String dateStr, String dataFormat) {
    try {
        SimpleDateFormat dateFormat = new SimpleDateFormat(dataFormat, Locale.PRC);
        Date date = dateFormat.parse(dateStr);
        return new Date(date.getTime());
    } catch (ParseException e) {
        LogUtils.warn(e);
        return null;
    }
}
 
Example 3
/**
 * 将yyyy-MM-dd HH:mm:ss字符串转换成日期<br/>
 *
 * @param dateStr    时间字符串
 * @param dataFormat 当前时间字符串的格式。
 * @return Date 日期 ,转换异常时返回null。
 */
public static Date parseDate(String dateStr, String dataFormat) {
    try {
        SimpleDateFormat dateFormat = new SimpleDateFormat(dataFormat, Locale.PRC);
        Date date = dateFormat.parse(dateStr);
        return new Date(date.getTime());
    } catch (ParseException e) {
        return null;
    }
}
 
Example 4
Source Project: AndroidDownload   File: DateUtils.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * 将yyyy-MM-dd HH:mm:ss字符串转换成日期<br/>
 *
 * @param dateStr    时间字符串
 * @param dataFormat 当前时间字符串的格式。
 * @return Date 日期 ,转换异常时返回null。
 */
public static Date parseDate(String dateStr, String dataFormat) {
    try {
        SimpleDateFormat dateFormat = new SimpleDateFormat(dataFormat, Locale.PRC);
        Date date = dateFormat.parse(dateStr);
        return new Date(date.getTime());
    } catch (ParseException e) {
        LogUtils.warn(e);
        return null;
    }
}
 
Example 5
Source Project: android   File: ExampleUnitTest.java    License: MIT License 5 votes vote down vote up
@Test
public void testStringLocale() throws Exception {
    Locale[] locales = new Locale[]{
            Locale.CANADA,
            Locale.CANADA_FRENCH,
            Locale.CHINESE,
            Locale.ENGLISH,
            Locale.FRANCE,
            Locale.GERMAN,
            Locale.GERMANY,
            Locale.ITALIAN,
            Locale.ITALY,
            Locale.JAPAN,
            Locale.JAPANESE,
            Locale.KOREA,
            Locale.KOREAN,
            Locale.PRC,
            Locale.ROOT,
            Locale.SIMPLIFIED_CHINESE,
            Locale.TAIWAN,
            Locale.TRADITIONAL_CHINESE,
            Locale.UK,
            Locale.US
    };

    String weightString = null;
    for (Locale locale : locales) {
        try {
            weightString = formatFloatWithOneDot(locale, 55.4f);
            float weight = Float.parseFloat(weightString);
        } catch (NumberFormatException e) {
            System.out.println(locale + ">>>>>" + weightString + ">>>>>>>>>> error");
            continue;
        }
        System.out.println(locale + ">>>>>" + weightString);
    }
}
 
Example 6
Source Project: AndroidPicker   File: DateUtils.java    License: MIT License 5 votes vote down vote up
/**
 * 将yyyy-MM-dd HH:mm:ss字符串转换成日期<br/>
 *
 * @param dateStr    时间字符串
 * @param dataFormat 当前时间字符串的格式。
 * @return Date 日期 ,转换异常时返回null。
 */
public static Date parseDate(String dateStr, String dataFormat) {
    try {
        SimpleDateFormat dateFormat = new SimpleDateFormat(dataFormat, Locale.PRC);
        Date date = dateFormat.parse(dateStr);
        return new Date(date.getTime());
    } catch (ParseException e) {
        LogUtils.warn(e);
        return null;
    }
}
 
Example 7
Source Project: a   File: DateUtils.java    License: GNU General Public License v3.0 4 votes vote down vote up
/**
 * 将指定的日期转换为一定格式的字符串
 */
public static String formatDate(Date date, String format) {
    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.PRC);
    return sdf.format(date);
}
 
Example 8
Source Project: FilePicker   File: DateUtils.java    License: MIT License 4 votes vote down vote up
/**
 * 将指定的日期转换为一定格式的字符串
 */
public static String formatDate(Date date, String format) {
    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.PRC);
    return sdf.format(date);
}
 
Example 9
/**
 * 将指定的日期转换为一定格式的字符串
 */
public static String formatDate(Date date, String format) {
    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.PRC);
    return sdf.format(date);
}
 
Example 10
Source Project: AndroidDownload   File: DateUtils.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * 将指定的日期转换为一定格式的字符串
 */
public static String formatDate(Date date, String format) {
    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.PRC);
    return sdf.format(date);
}
 
Example 11
Source Project: AndroidPicker   File: DateUtils.java    License: MIT License 4 votes vote down vote up
/**
 * 将指定的日期转换为一定格式的字符串
 */
public static String formatDate(Date date, String format) {
    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.PRC);
    return sdf.format(date);
}