Get Current Year in JavaScript

Priya Pallavi
Updated on 18-Jun-2020 09:24:47

3K+ Views

To get an only current year, use the JavaScript getFullYear() method. JavaScript date getFullYear() method returns the year of the specified date according to local time. The value returned by getFullYear() is an absolute number. For dates between the years 1000 and 9999, getFullYear() returns a four-digit number, for example, 2008.ExampleYou can try to run the following code to get a current year in JavaScript −Live Demo           JavaScript getFullYear Method                        var dt = new Date("December 30, 2017 23:15:00");          document.write("getFullYear() : " + dt.getFullYear() );           OutputgetFullYear() : 2017

Array Declarations in Java

karthikeya Boyini
Updated on 18-Jun-2020 09:24:40

955 Views

Here is the syntax for declaring an array variable −SyntaxdataType[] arrayRefVar;   // preferred way. or dataType arrayRefVar[];  // works but not preferred way.Note − The style dataType[] arrayRefVar is preferred. The style dataType arrayRefVar[] comes from the C/C++ language and was adopted in Java to accommodate C/C++ programmers.ExampleThe following code snippets are examples of this syntax −double[] myList;   // preferred way. or double myList[];   // works but not preferred way.Creating ArraysYou can create an array by using the new operator with the following syntax −SyntaxarrayRefVar = new dataType[arraySize];The above statement does two things −It creates an array ... Read More

Using Analytic View in SAP HANA

SAP Developer
Updated on 18-Jun-2020 09:21:55

359 Views

You are correct. In SAP HANA, Analytic Views are used to implement Star Schema queries wherein we join one Fact table to multiple Dimension tables. Analytic views use the real power of SAP HANA to performcomplex calculations and aggregate functions by joining tables in form of star schema and by executing Star schema queries.Following are key characteristics of SAP HANA Analytic View:Analytic Views are used to perform complex calculations and Aggregate functions like Sum, Count, Min, Max, Etc. Analytic Views are designed to run Start schema queries.Each Analytic View has one Fact table surrounded by multiple dimension tables. The fact table ... Read More

Bootstrap 4 Flex Wrap Class Implementation

Alex Onsman
Updated on 18-Jun-2020 09:18:32

224 Views

Use the flex-*-wrap class like flex-lg-wrap, flex-sm-wrap, flex-md-wrap, etc to wrap flex items on different screen sizes −The following is the code snippet for the flex items wrap on small screen size using the flex-sm-wrap class −   Poland   Netherlands   Ireland   Brazil You can try to run the following code to implement the flex-*-wrap class in Bootstrap 4 −ExampleLive Demo       Bootstrap Example                             Flex Examples     Wrap - Yes   ... Read More

Remove First Array Element in JavaScript and Return It

Abhinaya
Updated on 18-Jun-2020 09:17:42

302 Views

To remove first array element, use the JavaScript shift() method. JavaScript array shift() method removes the first element from an array and returns that element.ExampleYou can try to run the following code to remove first array element and return it −Live Demo           JavaScript Array shift Method                        var element = [30, 45, 70, 90, 110].shift();          document.write("Removed first element is : " + element );           OutputRemoved first element is : 30

Compare Two JavaScript Date Objects

Ramu Prasad
Updated on 18-Jun-2020 09:16:50

387 Views

To compare two date objects with JavaScript, create two dates object and get the recent date to compare it with the custom date.ExampleYou can try to run the following code to compare two dates −Live Demo                    var date1, date2;          date1 = new Date();          document.write(date1);          date2 = new Date( "Dec 10, 2015 20:15:10" );          document.write(""+date2);          if (date1 > date2) {             document.write("Date1 is the recent date.");          } else {             document.write("Date 2 is the recent date.");          }           OutputMon May 28 2018 09:48:49 GMT+0530 (India Standard Time) Thu Dec 10 2015 20:15:10 GMT+0530 (India Standard Time) Date1 is the recent date

Get the Current Year in JavaScript

Sravani S
Updated on 18-Jun-2020 09:16:11

3K+ Views

To get the current year, use the getFullYear() JavaScript method. JavaScript date getFullYear() method returns the year of the specified date according to local time. The value returned by getFullYear() is an absolute number. For dates between the years 1000 and 9999, getFullYear() returns a four-digit number, for example, 2008.ExampleYou can try to run the following code to get the current year −Live Demo           JavaScript getFullYear Method                        var dt = new Date("December 30, 2017 21:25:10");          document.write("getFullYear() : " + dt.getFullYear() );           OutputgetFullYear() : 2017

Initialize JavaScript Date to Midnight

V Jyothi
Updated on 18-Jun-2020 09:15:34

532 Views

To initialize a JavaScript Date to midnight, set hours like the following −setHours(0,0,0,0);ExampleYou can try to run the following code to set a date to midnight −Live Demo                    var dt;          dt = new Date();          dt.setHours(0,0,0,0);          document.write(dt);           OutputMon May 28 2018 00:00:00 GMT+0530 (India Standard Time)

Bootstrap 4 Float None Class

Alex Onsman
Updated on 18-Jun-2020 09:10:30

482 Views

If you want to remove float from an element, then Bootstrap 4 has a class called float-none.This removes the float −   This text is on the left (float removed). Default is left. On setting the float-none class, the text moves on the left, which is laso the default alignment settings.You can try to run the following code to implement the float-none class −ExampleLive Demo   Bootstrap Example             Demo       This text is on the left (on small screen). ... Read More

Float Element to the Left on Different Screens with Bootstrap

Alex Onsman
Updated on 18-Jun-2020 09:09:02

169 Views

On different devices like small, medium, large, etc, if you want to float an element to the left, then use the float-*-left class.The following are the classes you can use −Small Devices: float-sm-left Medium Devices: float-md-left Large Devices: float-lg-leftLet us see an example to float an element to the left on different screens −ExampleLive Demo       Bootstrap Example                             Demo           This text is on the left (on small screen).       This text is on the left (on medium screen).       This text is on the left (on large screen).       This text is on the left (on extra large screen).      

Advertisements