ковертация даты
This commit is contained in:
parent
09227a19c9
commit
6e1fed20b6
8
demo/.idea/.gitignore
vendored
Normal file
8
demo/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -1,16 +1,21 @@
|
||||
package com.example.demo.Dto;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class UserDTO {
|
||||
private String name;
|
||||
private String password;
|
||||
private String dateCreate;
|
||||
private Date dateCreate;
|
||||
|
||||
private final SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yy");
|
||||
public UserDTO() {
|
||||
|
||||
}
|
||||
@ -20,10 +25,9 @@ public class UserDTO {
|
||||
@JsonProperty(value = "name") String name,
|
||||
@JsonProperty(value = "dateCreate") String dateCreate,
|
||||
@JsonProperty(value = "password") String password
|
||||
)
|
||||
{
|
||||
) throws ParseException {
|
||||
this.name = name;
|
||||
this.dateCreate = dateCreate;
|
||||
this.dateCreate = formatter.parse(dateCreate);
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
@ -32,7 +36,7 @@ public class UserDTO {
|
||||
}
|
||||
|
||||
public String getDateCreate() {
|
||||
return dateCreate;
|
||||
return formatter.format(dateCreate);
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
|
Loading…
Reference in New Issue
Block a user