AM / PM 上的 SimpleDateFormat 问题
SimpleDateFormat issue on AM / PM
我有以下 SimpleDateFormat
:
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.FRANCE);
Date fullDate = sdf.parse(date + " " + time);
其中 date
是 24/01/2017
,time
是 12:55
(24 小时格式)。
但出于某种原因 Date
将时间识别为 00:55
。
我做错了什么?
通过将区域设置更改为美国并恢复以下格式:dd/MM/yyyy HH:mm
我已经解决了我的问题。
这是我现在拥有的:
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US);
Date fullDate = sdf.parse(date + " " + time);
我有以下 SimpleDateFormat
:
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.FRANCE);
Date fullDate = sdf.parse(date + " " + time);
其中 date
是 24/01/2017
,time
是 12:55
(24 小时格式)。
但出于某种原因 Date
将时间识别为 00:55
。
我做错了什么?
通过将区域设置更改为美国并恢复以下格式:dd/MM/yyyy HH:mm
我已经解决了我的问题。
这是我现在拥有的:
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy HH:mm", Locale.US);
Date fullDate = sdf.parse(date + " " + time);