Posts

Showing posts with the label Time

Javascript Current Date and Time

Image
Current Date and Time using Javascript This Code will output the Current Date (MM/DD/YYYY) and Time (12 hour method) using Javascript  Javascript <!DOCTYPE html> <title>Date and Time</title> <time id="date"></time> <time id="time"></time> <script>    var curDate = new Date(),     month = curDate.getMonth() + 1,     day = curDate.getDate(),     year = curDate.getFullYear(),     date = month + "/" + day + "/" + year;        document.getElementById("date").innerHTML = date;       var curTime = new Date(),     hours = curTime.getHours(),     minutes = curTime.getMinutes();    if (minutes < 10) {     minutes  = "0" + minutes;} var suffix = "AM"; if (hours >= 12) {     suffix = "PM";     ho...

Java Current Time and Date Program

Simple Java Current Time and Date Program This is a Straight Forward Code Example for obtaining the Current Time and Date using Java Programming Language. Java import java.util.Date; public class DateDemo {  public static void main(String args[]) { Date date = new Date();   String str = String.format("Current Date/Time : %tc", date ); System.out.printf(str); } }              Click Here to see this Code Run Java Fun Fact IT WAS JUST AN ACCIDENT! James Gosling was working at Sun Labs, around 1992. Gosling and his team was building a set-top box and started by "cleaning up" C++ and wound up with a new language and runtime. Thus, Java or Oak came into being. More Free Code Examples: Angular JS Click Counter Random Animal Generator Tutorial