Answers for "get current date"

17

return current date in javascript

let today = new Date().toLocaleDateString()

console.log(today)
Posted by: Guest on March-01-2020
22

java how to get current date

import java.time.format.DateTimeFormatter;  
import java.time.LocalDateTime;    
public class CurrentDateTimeExample1 {    
  public static void main(String[] args) {    
   DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy/MM/dd HH:mm:ss");  
   LocalDateTime now = LocalDateTime.now();  
   System.out.println(dtf.format(now));  
  }    
}
Posted by: Guest on June-10-2020
12

js get current date

var today = new Date();
var dd = String(today.getDate()).padStart(2, '0');
var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
var yyyy = today.getFullYear();

today = mm + '/' + dd + '/' + yyyy;
document.write(today);
Posted by: Guest on February-27-2020
4

print current date

from datetime import date

today = date.today()
print("Today's date:", today)
Posted by: Guest on April-28-2020
1

get today's date in js

let today = new Date().toISOString().slice(0, 10)

console.log(today)
Posted by: Guest on March-19-2021
2

java how to get current time

import java.util.Calendar;
Date currentTime = Calendar.getInstance().getTime();
Posted by: Guest on November-08-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language