Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] HH:mm:ss格式的时间无法解析为java.util.Date #2905

Closed
KaiserDeng opened this issue Aug 29, 2024 · 2 comments
Closed

[QUESTION] HH:mm:ss格式的时间无法解析为java.util.Date #2905

KaiserDeng opened this issue Aug 29, 2024 · 2 comments
Labels
bug Something isn't working fixed question Further information is requested
Milestone

Comments

@KaiserDeng
Copy link

`
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;

@DaTa
public class TestOrder {

@JSONField(format = "HH:mm:ss")
private Date saleEndTime;

public static void main(String[] args) {
    String s = "{\"saleEndTime\": \"23:00:00\"}";
    TestOrder order = JSON.parseObject(s, TestOrder.class);
    System.out.println(JSON.toJSONString(order));
}

}
从fastjson升级到2.0.52后执行以上代码时,出现报错: Text '23:00:00' could not be parsed: Unable to obtain LocalDateTime from TemporalAccessor: {},ISO resolved to 23:00 of type java.time.format.Parsed`

请问我该如何解决该问题?

@KaiserDeng KaiserDeng added the question Further information is requested label Aug 29, 2024
@wenshao wenshao added this to the 2.0.53 milestone Sep 1, 2024
@wenshao wenshao added the bug Something isn't working label Sep 1, 2024
@wenshao wenshao added the fixed label Sep 1, 2024
@KaiserDeng
Copy link
Author

thanks

@wenshao
Copy link
Member

wenshao commented Sep 16, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants