2

I have a SQL Server database field named 'JoiningDate' which has the type date (no time part here).To Capture the input from the user I am using ngx-bootstrap datepicker but the problem is that whenever I select a date from the datepicker, the datepicker itself converting the selected date into utc datetime as follows:

enter image description here

Sometimes it mismatches the date part due the utc time part.

My questions are:

  1. How can I get the the selected date as plain string like jQueryUI Datepicker?
  2. What is the best option get the input date exactly as it shown in input field?

1 Answer 1

1

You will need to write a simple function to convert the date object to the locale date string in format ("10/31/2018"), just as it is displayed in the input field:

convertDate(inputDate) {  
    // convert date received to locale string in 10/31/2018 format  
    const localeDate = inputDate.toLocaleDateString();  
    return localeDate;  
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.