java script print date in YYYY-MM-DD HH:MM:SS format
Java
let date_ob = new Date();
// adjust 0 before single digit date
let date = ("0" + date_ob.getDate()).slice(-2);
// current month
let month = ("0" + (date_ob.getMonth() + 1)).slice(-2);
// current year
let year = date_ob.getFullYear();
// current hours
let hours = date_ob.getHours();
// current minutes
let minutes = date_ob.getMinutes();
// current seconds
let seconds = date_ob.getSeconds();
// prints date & time in YYYY-MM-DD HH:MM:SS format
console.log(year + "-" + month + "-" + date + " " + hours + ":" + minutes + ":" + seconds);
Also in Java:
- Title
- check if a string is a substring of another string java
- Category
- Java
- Title
- break for loop java
- Category
- Java
- Title
- string to arraylist convert java
- Category
- Java
- Title
- java loop through array
- Category
- Java
- Title
- eliminar fila jtable java
- Category
- Java
- Title
- what is static setter and getter examples in java
- Category
- Java
- Title
- jbutton remove selection border
- Category
- Java
- Title
- convert hashset to array
- Category
- Java
- Title
- how to iterate list in java selenium
- Category
- Java
- Title
- how to convert string to double in android studio
- Category
- Java
- Title
- how to create a JFrame in java
- Category
- Java
- Title
- import java.util.hashset
- Category
- Java
- Title
- change fab image programatically
- Category
- Java
- Title
- java read file bufferedreader
- Category
- Java
- Title
- java "->"
- Category
- Java
- Title
- set java
- Category
- Java
- Title
- how to limit double decimal places java
- Category
- Java
- Title
- java permutation
- Category
- Java
- Title
- java replace all xml decoding
- Category
- Java
- Title
- java convert String to int
- Category
- Java
- Title
- java newinstance alternative
- Category
- Java
- Title
- computeifabsent hashmap java
- Category
- Java
- Title
- how to exit a for loop in java
- Category
- Java
- Title
- Linked List implementation
- Category
- Java
- Title
- java lambda list of objects cast
- Category
- Java
- Title
- java best way to concatenate strings
- Category
- Java
- Title
- java get last char of string
- Category
- Java
- Title
- if statement java
- Category
- Java
- Title
- binary to int java
- Category
- Java
- Title
- how to check if rs next is null
- Category
- Java
- Title
- eliminar el primer caracter de un string java
- Category
- Java
- Title
- a recursive function that calculates the greatest common divisor from user's input in java
- Category
- Java
- Title
- print hello world in java
- Category
- Java
- Title
- how to return the first character in an array from a method java
- Category
- Java
- Title
- java parse json
- Category
- Java
- Title
- remove action bar android studio
- Category
- Java
- Title
- how to detect device javascirpt
- Category
- Java
- Title
- how to add to a file in java
- Category
- Java
- Title
- java list all non directory files in the directory
- Category
- Java
- Title
- how to create a circle in java
- Category
- Java
- Title
- convert two bytes to int java
- Category
- Java
- Title
- java null pointer exception
- Category
- Java
- Title
- how to print a 2d array in java
- Category
- Java
- Title
- how to input in java
- Category
- Java
- Title
- how to get a user input in java
- Category
- Java
- Title
- priorityqueue poll
- Category
- Java
- Title
- difference between print and println in java
- Category
- Java
- Title
- logging in java
- Category
- Java
- Title
- discord jda remove @everyone from channel
- Category
- Java
- Title
- Write a method that raises a number to a power without using Math.pow() method
- Category
- Java
- Title
- java http client eviction
- Category
- Java
- Title
- ceil function in java
- Category
- Java
- Title
- recursion in java
- Category
- Java
- Title
- how to send http post create request using curl command
- Category
- Java
- Title
- add two numbers bitwise
- Category
- Java
- Title
- rock paper scissors java
- Category
- Java
- Title
- java find duplicates in array
- Category
- Java
- Title
- compile java to jar in mac
- Category
- Java
- Title
- java remove duplicates
- Category
- Java
- Title
- double round java integer
- Category
- Java
- Title
- java read integer from text file into array scanner
- Category
- Java
- Title
- JavaFX mouse over effe
- Category
- Java
- Title
- java loop
- Category
- Java
- Title
- print values of bst java
- Category
- Java
- Title
- read a file in java and store as integer array using buffered reader
- Category
- Java
- Title
- java mockito any string import
- Category
- Java
- Title
- 2d arrays | java
- Category
- Java
- Title
- java remove double spaces
- Category
- Java
- Title
- object orientation in java
- Category
- Java
- Title
- how to add strings together
- Category
- Java
- Title
- generic method lambda java
- Category
- Java
- Title
- islowercase java
- Category
- Java
- Title
- java get command line input
- Category
- Java
- Title
- java hashmap example
- Category
- Java
- Title
- java manacher's algorithm
- Category
- Java
- Title
- expression régulière téléphone java
- Category
- Java
- Title
- java nested for loop
- Category
- Java
- Title
- parsedouble java
- Category
- Java
- Title
- entre clavier java
- Category
- Java
- Title
- java resource file
- Category
- Java
- Title
- read csv in java in spring
- Category
- Java
- Title
- how to ask user for his location in android
- Category
- Java
- Title
- get long from date java
- Category
- Java
- Title
- how to add a keylistener to a jframe
- Category
- Java
- Title
- how to fill a list with a single value java
- Category
- Java
- Title
- override java
- Category
- Java
- Title
- esponente in java
- Category
- Java
- Title
- java map example
- Category
- Java
- Title
- fibonacci series i logn java
- Category
- Java
- Title
- java return new instance of generic type
- Category
- Java
- Title
- java regex replace all characters before
- Category
- Java
- Title
- java create arraly list
- Category
- Java
- Title
- determine if a given binary tree is a valid bst
- Category
- Java
- Title
- java localdate subtract two dates
- Category
- Java
- Title
- switch en java
- Category
- Java
- Title
- how to create a java jframe
- Category
- Java
- Title
- how to find complement of a number in java
- Category
- Java
- Title
- Java array equals
- Category
- Java
- Title
- byte java
- Category
- Java
- Title
- springBoot
- Category
- Java