Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js convert string to Date

// input 28/10/2018
// input DD/MM/YYYY
export const convertToDate = (dateSting) => {
    const [day, month, year] = dateSting.split("/");
    return new Date(parseInt(year), parseInt(month) - 1, parseInt(day));
}
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #convert #string #Date
ADD COMMENT
Topic
Name
6+8 =