Convert String Type to Date Type

xiaoxiao2021-03-06  37

With the SimpleDateFormat class, please refer to JDK. You can copy the following program.

Public class stringtodate {public static void main (String [] args) {SimpleDateFormat Formatter = New SimpleDateFormat ("YYY-MM-DD HH: MM: SS"); string infut = "1818-11-11 11:11:11" DATE T; Try {T = formatter.parse (INPUT); System.out.println (T);} catch (parseException e) {system.out.println ("unparseable using" formatter;}}}

Ayuan

9CBS certified blog expert

Blog expert

Huawei old employees

Big Data

More than ten years, in Huawei, Internet Corporation's experience, profound understanding and practical experience in CRM, big data, mainly sharing various project experience, including architecture, Java, big data and other articles

转载请注明原文地址:https://www.9cbs.com/read-62244.html

New Post(0)