current date and time code example
Example 1: python get date and time
import datetime
now = datetime.datetime.now()
print ("Current date and time : ")
print (now.strftime("%Y-%m-%d %H:%M:%S"))
Example 2: How to get current date and time in java
import java.util.Calendar;
import java.util.Date;
public class UsingCalendarClass
{
public static void main(String[] args)
{
Date date = Calendar.getInstance().getTime();
System.out.println(date);
}
}
Example 3: How to get current date and time in java
import java.time.LocalDate;
public class UsingLocalDate
{
public static void main(String[] args)
{
System.out.println(LocalDate.now());
}
}
Example 4: python print datetime
import datetime
print("Now:", datetime.datetime.now())