C
C
Chvalov2017-10-08 16:17:59
Java
Chvalov, 2017-10-08 16:17:59

Java and Timestamp, in what format to pass time to a variable?

import java.sql.Timestamp;

public class UserAddress {
    private Integer id;
    private String Address;
    private Boolean processed;
    private Timestamp update_up;

...
   public Timestamp getUpdate_up() {
        return update_up;
    }

    public void setUpdate_up(Timestamp update_up) {
        this.update_up = update_up;
    }

But I don't know how to pass the time
@RestController
public class DashboardController {

    @RequestMapping("/dashboard")
    public List<UserAddress> getAllUserAddressList() {
        return Arrays.asList(
                new UserAddress(1,"test",true, null),
                new UserAddress(2,null,false,null),
                new UserAddress(3,"test test",true,null)
        );
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
C
Chvalov, 2017-10-08
@Chvalov

Timestamp.valueOf("2017-10-08 17:24:06")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question