我使用给定日期作为参数创建一个URL。
这个日期就这样创造了:
final String from = DateFormat.format("dd.MM.yyyy", date).toString();
此字符串已添加到网址:
+ "&from=" + from
错误开始出现在我的Crashlytics记者身上。要进行调试,我将其设置为报告正在发送的URL。
如何生成的网址如下所示:&from=٢٩.٠٦.٢٠١٦
?
答案 0 :(得分:1)
正如Blackbelt所说,由于用户手机上的Locale,日期的格式是这样的。
您只需将日期转换为您想要指定英语区域设置的格式。
SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy", Locale.ENGLISH);
String from = dateFormat.format(date);
答案 1 :(得分:1)
由于您手机的默认Locale
而导致。
使用此选项以正确的格式获取日期:
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("dd.MM.yyyy", Locale.ENGLISH);
String from = simpleDateFormat.format(date);
详细了解SimpleDateFormat
here。