我在 ionic4 中使用 ion-datetime 使用 NgModel 绑定到一个属性,但是,无论我在格式中包含什么选项,我总是得到包含时间戳的时间。¿如何从结果中删除时间戳,以便我的属性的最终值类似于“2019-04-22”而不是“2019-04-22T08:45:41.243-05:00”?
我试过了:但是,我仍然得到时间戳
<ion-datetime max="2030" min="2019" [(ngModel)]="mydate" display-format="MMM DD, YYYY"></ion-datetime>
Run Code Online (Sandbox Code Playgroud)
我希望结果类似于:“2019-04-22”,但我不断收到:“2019-04-22T08:45:41.243-05:00”
我的目标是获取用户选择的图片并使用它填充图像视图.然后,在单击按钮时,该图像将被发送到Parse数据库.我知道我必须将imageview转换为字节数组,但似乎不起作用.
任何帮助将受到高度赞赏.这是我的代码:
//send the imageviwew to parse database
public void sendToParseBtn (View view){
Bitmap bitmapImage = findViewById (R.id.imageView);
ImageView imageView = (ImageView) findViewById(R.id.imageView);
imageView.setImageBitmap(bitmapImage);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmapImage.compress(Bitmap.CompressFormat.JPEG, 40, stream);
byte[] byteArray = stream.toByteArray();
ParseFile file = new ParseFile("an.jpg",byteArray);
ParseObject object = new ParseObject("MyParseObject");
object.put("imageFile", file);
object.saveInBackground();
}
Run Code Online (Sandbox Code Playgroud)