-
/*Java Date to String ExampleThis Java Date to String example shows how to convert java.util.Date toString in Java.*/
import java.text.DateFormat;import java.text.SimpleDateFormat;import java.util.Date;
public class ConvertDateToStringExample
{
public static void main(String args[])
{
//create new java.util.Date objectDate date = new Date();
/** To convert java.util.Date to String, use SimpleDateFormat class.*/
/** crate new SimpleDateFormat instance with desired date format.* We are going to use yyyy-mm-dd hh:mm:ss here.*/DateFormat dateFormat = new SimpleDateFormat(“yyyy-mm-dd hh:mm:ss”);
//to convert Date to String, use format method of SimpleDateFormat class.String strDate = dateFormat.format(date);
System.out.println(“Date converted to String: “ + strDate);
}}
/*Output of above given java.util.Date to String example would beDate converted to String: 2011-17-10 11:17:50*/
Friday 13 April 2018
Popular Posts
-
This textbook grew out of notes for the ECE143 Programming for Data Analysis class that the author has been teaching at University of Cali...
-
What you'll learn Use SQL commands to filter, sort, & summarize data; manipulate strings, dates, & numerical data from differe...
-
There are 6 modules in this course Cybersecurity affects everyone, including in the delivery of basic products and services. If you or you...
-
This Python code defines a function and then calls it with specific arguments. Let's break it down step by step: Function Definition: ...
-
In Python, dictionaries are compared based on their keys and corresponding values. When you use the != operator to compare two dictionarie...
-
What you'll learn Develop custom Python scripts to automate cybersecurity tasks. Apply Python to meet objectives through the cybersecu...
-
import turtle def draw_ring(color, x, y): turtle.penup() turtle.color(color) turtle.goto(x, y) turtle.pendown() turtle...
-
There are 12 modules in this course Stanford's "Introduction to Statistics" teaches you statistical thinking concepts that a...
-
What you'll learn Create basic visualizations such as line graphs, bar graphs, and pie charts using Excel spreadsheets. Explain the im...
-
Are you eager to dive into the world of Java programming and software engineering? Coursera offers an excellent course titled Java Program...
Categories
AI
(28)
Android
(24)
AngularJS
(1)
Assembly Language
(2)
aws
(17)
Azure
(7)
BI
(10)
book
(4)
Books
(121)
C
(77)
C#
(12)
C++
(82)
Course
(66)
Coursera
(184)
Cybersecurity
(24)
data management
(11)
Data Science
(99)
Data Strucures
(7)
Deep Learning
(11)
Django
(6)
Downloads
(3)
edx
(2)
Engineering
(14)
Excel
(13)
Factorial
(1)
Finance
(6)
flutter
(1)
FPL
(17)
Google
(19)
Hadoop
(3)
HTML&CSS
(46)
IBM
(25)
IoT
(1)
IS
(25)
Java
(93)
Leet Code
(4)
Machine Learning
(46)
Meta
(18)
MICHIGAN
(5)
microsoft
(4)
Pandas
(3)
PHP
(20)
Projects
(29)
Python
(792)
Python Coding Challenge
(273)
Questions
(2)
R
(70)
React
(6)
Scripting
(1)
security
(3)
Selenium Webdriver
(2)
Software
(17)
SQL
(41)
UX Research
(1)
web application
(8)
0 Comments:
Post a Comment