in Education by
I am getting Facebook users' friends birthday back from Facebook in the following format: 10/07/1967 or just the day and month as 10/07 I want to display it as "October, 07, 1967" or "October, 07" Is there a way to convert this string into a date and format it in Javascript? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
var MONTHS = ["January","February","March","April","May","June","July","August","September","October","November","December"]; var myDate, myFormatDate; var date_str ='10/07/1967'; var t = date_str.split("/"); if(t[2]) { myDate = new Date(t[2], t[0] - 1, t[1]); myFormatDate = MONTHS[myDate.getMonth()] + "," + myDate.getDate() + "," + myDate.getFullYear(); } else { myDate = new Date(new Date().getFullYear(), t[0] - 1, t[1]); myFormatDate = MONTHS[myDate.getMonth()] + "," + mydate.getDate(); } = RESULT: = myDate -- the Date Object = myFormatDate -- formated date string "October, 07, 1967"

Related questions

0 votes
    I am getting Facebook users' friends birthday back from Facebook in the following format: 10/07/1967 or ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 21, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: converting date format (5 answers) Closed 5 years ago. I have a ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have a data which looks like EX:992215:SHOW:CMS016:000335:ESP:15:EUR:Euro:4:14:01/05/2009 :30 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have a data which looks like EX:992215:SHOW:CMS016:000335:ESP:15:EUR:Euro:4:14:01/05/2009 :30 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    I have a data which looks like EX:992215:SHOW:CMS016:000335:ESP:15:EUR:Euro:4:14:01/05/2009 :30 ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    What will be the syntax to find current date and time in format "YYYY-MM-DD"?...
asked Dec 18, 2020 in Technology by JackTerrance
0 votes
    I have an XML and would like to : sort on employeeNumber, and for each bookingtime by year, month ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 29, 2022 in Education by JackTerrance
0 votes
    Which of the following input control represents a date (year, month, day) encoded according to ISO 8601 in Web Form 2.0?...
asked Apr 10, 2021 in Education by JackTerrance
0 votes
    Which of the following input control represents a date (year, month, day) encoded according to ISO 8601 in Web Form 2.0? A - datetime B - datetime-local C - date D - month...
asked Dec 1, 2020 in Technology by JackTerrance
0 votes
    I am trying to convert string into integer using jquery but it throwing NumberFormatException. How to fix it ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
0 votes
    var str = ' Header Paragraph I have a string str I want to separate h1 and p text. Result: var ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    var str = ' Header Paragraph I have a string str I want to separate h1 and p text. Result: var ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    var str = ' Header Paragraph I have a string str I want to separate h1 and p text. Result: var ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    var str = ' Header Paragraph I have a string str I want to separate h1 and p text. Result: var ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
0 votes
    var str = ' Header Paragraph I have a string str I want to separate h1 and p text. Result: var ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 26, 2022 in Education by JackTerrance
...