+ 1

Find Date and Time using code ?

any language as you want. Get current date and time and print it

13th Sep 2018, 8:49 PM
Rishabh Mehta
5 Antworten
+ 8
🐍 import datetime print(datetime.datetime.now())
13th Sep 2018, 9:37 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
/*add this to the main method in Java and run*/ System.out.println(new Date());
13th Sep 2018, 8:53 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
+ 3
// Try this instead: /* WILL NOT PRINT DATE ACCORDING TO YOUR TIME ZONE, AS THE CODE ITSELF IS NOT EXECUTING ON YOUR DEVICE, BUT ON SOLOLEARN SERVER - THATS IF YOU RUN IT ON SOLOLEARN*/ import java.text.*; public class Date { public static void main(String[] args) { SimpleDateFormat f = new SimpleDateFormat ("h:m a E,MMMM Y"); System.out.println(f.format(new java.util.Date())); } }
13th Sep 2018, 10:26 PM
Mind To Machine 💻🕆
Mind To Machine 💻🕆 - avatar
13th Sep 2018, 8:59 PM
Rishabh Mehta
+ 1
in Ruby : puts Time.now.strftime("%d/%m/%Y %H:%M")
13th Sep 2018, 9:19 PM
Nifriz
Nifriz - avatar