当前位置: 首页>>代码示例>>Java>>正文


Java Locale.CHINA属性代码示例

本文整理汇总了Java中java.util.Locale.CHINA属性的典型用法代码示例。如果您正苦于以下问题:Java Locale.CHINA属性的具体用法?Java Locale.CHINA怎么用?Java Locale.CHINA使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.util.Locale的用法示例。


在下文中一共展示了Locale.CHINA属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCurrentDateTime

/**
 * 根据设置格式类型,获取当前日期时间
 * 
 * @param type
 *          返回日期时间形式<br>
 *          0, 20130123150123<br>
 *          1, 2013-01-23T15:01:23.357<br>
 *          2, 20130123<br>
 *          3, 150123<br>
 *          4, 15:01:23.456<br>
 *          默认, 20130123150123<br>
 * 
 * @return String 日期时间字符串
 */
public static String getCurrentDateTime(int type) {
	String pattern = "yyyyMMddHHmmss";

	switch (type) {
	case 0: // 默认值
		break;
	case 1:
		pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS";
		break;
	case 2:
		pattern = "yyyyMMdd";
		break;
	case 3:
		pattern = "HHmmss";
		break;
	case 4:
		pattern = "HH:mm:ss.SSS";
		break;
	default: // 默认值
		break;
	}
	SimpleDateFormat df = new SimpleDateFormat(pattern, Locale.CHINA); // 设置日期格式
	return df.format(new Date());
}
 
开发者ID:quanqinle,项目名称:WebAndAppUITesting,代码行数:38,代码来源:TimeUtil.java

示例2: test_codec

public void test_codec() throws Exception {
    JSONReader reader = new JSONReader(new StringReader("{\"value\":\"2016-04-29\"}"));
    reader.setLocale(Locale.CHINA);
    reader.setTimzeZone(TimeZone.getTimeZone("Asia/Shanghai"));
    
    Model model = reader.readObject(Model.class);
    Assert.assertNotNull(model.value);
    
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
    format.setTimeZone(TimeZone.getTimeZone("Asia/Shanghai"));
    Date date = format.parse("2016-04-29");
    Assert.assertEquals(date.getTime(), model.value.getTime());
    
    Assert.assertEquals(TimeZone.getTimeZone("Asia/Shanghai"), reader.getTimzeZone());
    Assert.assertEquals(Locale.CHINA, reader.getLocal());
    
    reader.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:DateTest_tz.java

示例3: CustomDatePicker

public CustomDatePicker(Context context, ResultHandler resultHandler, String startDate, String endDate) {
    if (isValidDate(startDate, "yyyy-MM-dd HH:mm") && isValidDate(endDate, "yyyy-MM-dd HH:mm")) {
        canAccess = true;
        this.context = context;
        this.handler = resultHandler;
        selectedCalender = Calendar.getInstance();
        startCalendar = Calendar.getInstance();
        endCalendar = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
        try {
            startCalendar.setTime(sdf.parse(startDate));
            endCalendar.setTime(sdf.parse(endDate));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        initDialog();
        initView();
    }
}
 
开发者ID:Jusenr,项目名称:androidtools,代码行数:19,代码来源:CustomDatePicker.java

示例4: convertString

/**
 * 格式化时间
 * @param value 需要格式化的时间字符串
 * @param format 对应时间字符串的格式化参数,如:yyyy-MM-dd HH:mm:ss
 * @return Date
 */
public static Date convertString(String value, String format)
{
	SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINA);
	if(value == null)
	{
		return null;
	}
	try
	{
		return sdf.parse(value);
	}
	catch(Exception e)
	{
		return null;
	}
}
 
开发者ID:skeychen,项目名称:dswork,代码行数:22,代码来源:TimeUtil.java

示例5: msToDate

/**
 * 把毫秒格式化成日期输出
 *
 * @param ms
 * @throws Exception
 */
public static String msToDate(long ms) {
    long l = ms;
    Date date = new Date(l);
    SimpleDateFormat f = new SimpleDateFormat("MM月dd日 HH:mm", Locale.CHINA);
    String time = f.format(date);
    return time;
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:13,代码来源:NormalUtil.java

示例6: openCamera

public void openCamera(Context context) {


        boolean image = mConfiguration.isImage();

        Intent captureIntent = image ? new Intent(MediaStore.ACTION_IMAGE_CAPTURE) : new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
        if (captureIntent.resolveActivity(context.getPackageManager()) == null) {
            Toast.makeText(getContext(), R.string.gallery_device_camera_unable, Toast.LENGTH_SHORT).show();
            return;
        }

        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss", Locale.CHINA);
        String filename = String.format(image ? IMAGE_STORE_FILE_NAME : VIDEO_STORE_FILE_NAME, dateFormat.format(new Date()));
        Logger.i("openCamera:" + mImageStoreDir.getAbsolutePath());
        File fileImagePath = new File(mImageStoreDir, filename);
        mImagePath = fileImagePath.getAbsolutePath();

        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
            captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(fileImagePath));
        } else {
            ContentValues contentValues = new ContentValues(1);
            contentValues.put(MediaStore.Images.Media.DATA, mImagePath);
            Uri uri = getContext().getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);
            captureIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
        }
        // video : 1: 高质量  0 低质量
//        captureIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
        startActivityForResult(captureIntent, TAKE_IMAGE_REQUEST_CODE);
    }
 
开发者ID:Loofer,项目名称:Watermark,代码行数:29,代码来源:MediaGridFragment.java

示例7: createImageFile

private File createImageFile() throws IOException {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA);
    String imageFileName = "IMG_" + dateFormat.format(new Date());

    File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
    return new File(storageDir + File.separator + imageFileName + ".jpeg");
}
 
开发者ID:GitPhoenix,项目名称:VanGogh,代码行数:7,代码来源:VanConfig.java

示例8: msToMinute

/**
 * 把毫秒格式化成日期输出
 *
 * @param ms
 * @throws Exception
 */
public static int msToMinute(long ms) {
    long l = ms;
    Date date = new Date(l);
    SimpleDateFormat f = new SimpleDateFormat("mm", Locale.CHINA);
    String time = f.format(date);
    int h = 0;
    try {
        h = Integer.parseInt(time);
    } catch (NumberFormatException e) {
        e.printStackTrace();
    }
    return h;
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:19,代码来源:NormalUtil.java

示例9: startCropActivity

/**
 * 跳转到裁剪页面
 *
 * @param source 需要裁剪的图片
 */
private void startCropActivity(Uri source) {
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.CHINA);
    String imageFileName = "IMG_" + dateFormat.format(new Date());

    Uri uri = Uri.fromFile(new File(getCacheDir(), imageFileName.concat(".jpeg")));
    UCrop.of(source, uri)
            .withAspectRatio(1, 1)
            .withMaxResultSize(1024, 1024)
            .withTargetActivity(VanCropActivity.class)
            .start(this);
}
 
开发者ID:GitPhoenix,项目名称:VanGogh,代码行数:16,代码来源:MainActivity.java

示例10: getLocale

private static Locale getLocale(RequestHeader header) {
    Locale locale = Locale.CHINA;
    //		try {
    //			locale = StringUtils.isBlank(header.getLanguage()) ? Locale.CHINA : new Locale(header.getLanguage(),header.getArea());
    //		} catch (Exception e) {
    //			locale = Locale.CHINA;
    //		}
    return locale;
}
 
开发者ID:warlock-china,项目名称:azeroth,代码行数:9,代码来源:I18nUtils.java

示例11: setUp

protected void setUp() throws Exception {
    JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
    JSON.defaultLocale = Locale.CHINA;

    com.alibaba.fastjson.parser.ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_8.");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:Bug_for_lenolix_8.java

示例12: setUp

protected void setUp() throws Exception {
    JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
    JSON.defaultLocale = Locale.CHINA;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:DefaultJSONParserTest_date.java

示例13: date2str

public static String date2str(Date date, String format) {
    SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.CHINA);
    return sdf.format(date);
}
 
开发者ID:Horrarndoo,项目名称:YiZhi,代码行数:4,代码来源:DateUtils.java

示例14: dateYMD

public static String dateYMD(long time) {
    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd", Locale.CHINA);
    return format.format(time);
}
 
开发者ID:coderwjq,项目名称:ZhaZhaShop,代码行数:4,代码来源:TimeUtils.java

示例15: setUp

protected void setUp() throws Exception {
    JSON.defaultTimeZone = TimeZone.getTimeZone("Asia/Shanghai");
    JSON.defaultLocale = Locale.CHINA;

    ParserConfig.global.addAccept("com.alibaba.json.bvt.bug.Bug_for_lenolix_7");
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:6,代码来源:Bug_for_lenolix_7.java


注:本文中的java.util.Locale.CHINA属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。