更改android的媒体DATE_TAKEN格式(change android's media DATE_TAKEN format)
我正在获取使用的日期图像
int columnIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN);
String dateAdded = cursor.getString(columnIndex);
我得到的结果是dateFormat = 1430334035295
如何将dateAdded转换为正确的MM-dd-yyyy hh:mm:ss格式?
I am obtaining the date image was captured using
int columnIndex = cursor.getColumnIndex(MediaStore.Images.Media.DATE_TAKEN);
String dateAdded = cursor.getString(columnIndex);
The result i get is dateFormat = 1430334035295
How do I convert dateAdded into a proper MM-dd-yyyy hh:mm:ss format??
原文:https://stackoverflow.com/questions/30106784
更新时间:2020-02-26 19:35
最满意答案
String format = "MM-dd-yyyy HH:mm:ss";
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
String dateTime = formatter.format(new Date(Long.parseLong(dateAdded)));
String format = "MM-dd-yyyy HH:mm:ss";
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
String dateTime = formatter.format(new Date(Long.parseLong(dateAdded)));
2015-05-07
相关问答
要覆盖DatePicker格式,最好的办法是重写其中一个构造函数,并对原始代码进行轻微编辑。 你可以在代码中编辑ViewGroup给你,但我会认真考虑不这样做。 创建类LocalizedDatePicker 覆盖公共DatePicker(上下文上下文,AttributeSet attrs,int defStyle) http://developer.android.com/reference/android/widget/DatePicker.html#DatePicker (android.co
...
正确的使用方法是AudioManager上的setStreamVolume 。 它可能看起来像这样 AudioManager audioManager =
(AudioManager)getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
[int value],
...
我相信表格列的具体方式不同。 试试这些变种: timestamp
timestamp(0) no millis
timestamptz with timezone
timestamptz(0) with timezone, no millis
Daniel tells me to post my findings as an answer and accept it to close the question. Okay. I found that the date format I
...
试试这个代码: try {
String str = "20/02/2014";
SimpleDateFormat sdf1 = new SimpleDateFormat("dd/MM/yyyy");
SimpleDateFormat sdf2 = new SimpleDateFormat("MMMM dd,yyyy");
System.out.println("Formatted Date : "+sdf2.for
...
根据javadoc ,方法getYear返回年份减去1900.月份的数量从0到11,所以你应该使用getMonth加1。 无论如何我建议你使用更可靠的对象日历: public static String getCrDate(File file) {
long lastTime = file.lastModified();
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(lastTime);
int day =
...
我认为您必须使用自己的类扩展DatePicker类,并根据需要进行修改。 Afaik没有可用于轻松修改此属性的属性。 I think you have to extend the DatePicker class with your own, and modify it as you like. Afaik there are no attributes that you could use to easily modify this.
我想知道,您如何在不包含bootstrap css文件的情况下使用代码。
String format = "MM-dd-yyyy HH:mm:ss";
SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.ENGLISH);
String dateTime = formatter.format(new Date(Long.parseLong(dateAdded)));
String format = "MM-dd-yyyy HH:mm:ss";
SimpleDateFormat format
...
我有一种感觉问题是当你调用mCamera.lock(); 尝试删除在这里: private void releaseMediaRecorder(){
if (mMediaRecorder != null) {
mMediaRecorder.reset(); // clear recorder configuration
mMediaRecorder.release(); // release the recorder object
mMediaRecorder = nu
...