To convert a Unix timestamp to time, you can try to run the following code in JavaScript −ExampleLive Demo JavaScript Dates var unix_time = 1514791901 ; var date = new Date(unix_time*1000); // get hours var hrs = date.getHours(); // get minutes var min = "0" + date.getMinutes(); // get seconds var sec = "0" + date.getSeconds(); document.write("Time- "+hrs + ":" + min.substr(-2) + ":" + sec.substr(-2)); OutputTime- 13:01:41
automatic resource management or try-with-resources is a new exception handling mechanism that was introduced in Java 7, which automatically closes the resources used within the try-catch block.ResourceA resource is an object which is required to be closed once our program finishes. For example, a file is read, database connection and so on.UsageTo use the try-with-resources statement, you simply need to declare the required resources within the parenthesis, and the created resource will be closed automatically at the end of the block. Following is the syntax of the try-with-resources statement.Syntaxtry(FileReader fr = new FileReader("file path")) { // use the resource ... Read More
To create a date object from date string, just add the string like this −var date = new Date(2018,1,1);ExampleYou can try to run the following code to create date object from date string. Here, the month is indexed as 0 for Jan, 1 for Feb, etc in JavaScript −Live Demo JavaScript Dates var date; date = new Date(2018,0,1); document.write("Current Date: "+date); OutputCurrent Date: Mon Jan 01 2018 00:00:00 GMT+0530 (India Standard Time)
The modal(“show”) method opens a modal like below −The modal is displayed using the modal(“show”) method as shown below −$("#newModal").modal("show");Let us see an example of modal(“show”) method −ExampleLive Demo Bootstrap Example #button1 { width: 140px; padding: 20px; bottom: 150px; z-index: 9999; font-size: 15px; position: absolute; margin: 0 auto; } ... Read More
To align flex items around on different screen sizes, use the justify-content-*-around class.You can achieve the following result that justifies content on small and medium screen sizes −To implement the justify-content-*-around class in Bootstrap −ExampleLive Demo Bootstrap Example Default ANS 1 ANS 2 ANS 3 Small Screen Size ANS 1 ANS 2 ANS 3 Medium Screen Size ANS 1 ANS 2 ANS 3 Large Screen Size ANS 1 ANS 2 ANS 3
To convert time in seconds, firstly get the current time. Then, multiply the hours to 3600 and minutes to 60; rest you can see below −(hours*3600) + (min*60) + secExampleYou can try to run the following code to get the current time in seconds −Live Demo JavaScript Get Seconds var dt = new Date(); var sec = dt.getSeconds(); document.write("Seconds: " + sec); var min = dt.getMinutes(); document.write("Minutes: " + min); var hrs = dt.getHours(); document.write("Hours: " + hrs); var total_seconds = (hrs*3600) + (min*60) + sec; document.write("Total seconds: " + total_seconds) ; OutputSeconds: 35 Minutes: 37 Hours: 9 Total seconds: 34655
Use the bg-info class with the card-class in Bootstrap 4 to add information in a card −Now include the card-body class in it − Bring your Laptop for the BootCamp Let us see an example to learn how to implement Bootstrap 4 bg-info class with the card class −ExampleLive Demo Bootstrap Example Information - Event Bring your Laptop for the BootCamp
Use the justify-content-*-center class in Bootstrap 4 to center content on different screen sizes.For different screen sizes −justify-content-sm-center: Small Screen Size justify-content-md-center: Medium Screen Size justify-content-lg-center: Large Screen Size justify-content-xl-center: Extra Large Screen SizeLet us see how to implement the justify-content-*-center class −ExampleLive Demo Bootstrap Example Vehicle Car Bike Truck Car Bike Truck Car Bike Truck Car Bike Truck
Use the .justify-content-*-end class to align flex items in the end on different screen sizes like this −For small screen size, use −justify-content-sm-endFor medium screen size, use −justify-content-md-endFor large screen size, use −justify-content-lg-endLet us see how to align flex items horizontally on small, medium and large screen sizes −ExampleLive Demo Bootstrap Example Form of Tea Black Tea Green Tea Indian Tea Black Tea Green Tea Indian Tea Black Tea Green Tea Indian Tea
To add left rounded corners to an element like , then use the rounded-left class in Bootstarp 4.To set rounded left corners −You can try to run the following code to implement rounded-left class −ExampleLive Demo Bootstrap Example .one { width: 200px; height: 100px; background-color: #FFFF00; margin: 8px; } Rounded Corner We have three rectangles with left rounded corner:
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP