0

I want to display the user time in the format "hh:mm a", but in the database I want to save the time in the format of unix timestamp. Is it possible to get the unix timestamp from DatePicker?

This is my code for the DatePicker:

<DatePicker
        style={{ width: 130, marginLeft: -35 }}
        date={this.props.endAt}
        mode="time"
        placeholder="End time"
        format="hh:mm a"
        confirmBtnText="Confirm"
        cancelBtnText="Cancel"
        onDateChange={(date) => { this.props.onEndTimeClicked(this.props.id, date) }}
      />
Lucky_girl
  • 4,543
  • 6
  • 42
  • 82
  • 2
    You can use a function to convert the date. Check [this](https://stackoverflow.com/questions/11893083/convert-normal-date-to-unix-timestamp) answer. – Mateo Guzmán May 11 '18 at 15:58

0 Answers0