Posts

Showing posts with the label date

javascript : Object.isDate

  javascript : Object .isDate Target: Applicable with any javascript  Object  Variable  that holds date value . Description : When an object holds an date then it return  true  otherwise  undefined . basically it is defined in Date prototype. Many time in programming we face a problem that an object variable holds Date value or other object structure then it help us. Before writing the code of Date manipulation we can check whether a variable holds Date value or not. Note: It is an property of Date, that is defined in Date Prototype. It is useful to check an object variable is Date or any other type. When we check the typeof(object_variable) it return 'object' not 'date'. Syntax: Object .isDate return  true  when object hold's Date value otherwise  undefined Usase: var obj = 'date'; if(obj.isDate){      console.log('Object holds date value'); } else{      console.log('Object is not a date value'); ...

javascript : String.toDate()

  javascript : String .toDate() Target: Applicable with  String  Data Type. Description : convert string to Date object. Date should be "dd-MMM-yyyy" or "dd-MM-yyyy" Note: In case of invalid date string it return "1-Jan-1900" Syntax: String .toDate() Usase: "11-Oct-2019".toDate() It return Date "Fri Oct 11 2019 00:00:00 GMT+0530 (India Standard Time)" "11/Oct/2019".toDate() It return Date "Fri Oct 11 2019 00:00:00 GMT+0530 (India Standard Time)" "11.Oct.2019".toDate() It return Date "Fri Oct 11 2019 00:00:00 GMT+0530 (India Standard Time)" "5Jun2019".toDate() It return Date "Wed Jun 05 2019 00:00:00 GMT+0530 (India Standard Time)" "15Jun".toDate() It return Date "Sat Jun 15 2019 00:00:00 GMT+0530 (India Standard Time)" "28, Jun".toDate() It return Date "Fri Jun 28 2019 00:00:00 GMT+0530 (India Standard Time)" "11, oct - 2019".to...

javascript : Date.addYears(number)

  javascript : Date .addYears( Number ) Target: Applicable with  Date  Data Type. Description : Add/Subtract years from Date and return new Date object. Syntax: Date .addYears( number ) Usase: var dd = '1 Apr 2020'.toDateTime(); dd.addYears(1); It return "Thu Apr 01 2021 00:00:00 GMT+0530 (India Standard Time)" dd.addYears(-1); It return "Mon Apr 01 2019 00:00:00 GMT+0530 (India Standard Time)" Download MYJS.js MyJs is a collection of java script extension methods that enhances the JavaScript objects, class object, DOM element, domElementsCollections, Date, String, Number and other data type.  Include in you project landing page (master page) and it will extends your DOM and JavaScript Objects.

javascript : Date.addMonths(number)

  javascript : Date .addMonths( Number ) Target: Applicable with  Date  Data Type. Description : Add/Subtract months from Date and return new Date object. Syntax: Date .addMonths( number ) Usase: var dd = '1 Apr 2020'.toDateTime(); dd.addMonths(1); It return "Fri May 01 2020 00:00:00 GMT+0530 (India Standard Time)" dd.addMonths(-1); It return "Sun Mar 01 2020 00:00:00 GMT+0530 (India Standard Time)" Download MYJS.js MyJs is a collection of java script extension methods that enhances the JavaScript objects, class object, DOM element, domElementsCollections, Date, String, Number and other data type.  Include in you project landing page (master page) and it will extends your DOM and JavaScript Objects.

javascript : Date.addDays(number)

  javascript : Date .addDays( Number ) Target: Applicable with  Date  Data Type. Description : Add/Subtract days from Date and return new Date object. Syntax: Date .addDays( number ) Usase: var dd = '1 Apr 2020'.toDateTime(); dd.addDays(5); It return "Mon Apr 06 2020 00:00:00 GMT+0530 (India Standard Time)" dd.addDays(-5); It return "Fri Mar 27 2020 00:00:00 GMT+0530 (India Standard Time)" Download MYJS.js MyJs is a collection of java script extension methods that enhances the JavaScript objects, class object, DOM element, domElementsCollections, Date, String, Number and other data type.  Include in you project landing page (master page) and it will extends your DOM and JavaScript Objects.