Get the App
SLTechnology News&Howtos  ›  Development  › 

Example Analysis of date Type of string Interchange in java

Shulou Source: shulou.com Published: 2022-06-01 02:14:02 09月21日 Update

Editor to share with you the java string interchange date type example analysis, I believe that most people do not know much about it, so share this article for your reference, I hope you will learn a lot after reading this article, let's go to know it!

String interchange date type

Package com.shxt.demo02; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; public class Demo18 {public static void main (String [] args) {LocalDateTime date = LocalDateTime.now (); DateTimeFormatter format1 = DateTimeFormatter.ofPattern ("yyyy/MM/dd HH:mm:ss"); / / date transfer string String str = date.format (format1) System.out.println ("date to string:" + str); DateTimeFormatter format2 = DateTimeFormatter.ofPattern ("yyyy/MM/dd HH:mm:ss"); / / string conversion date LocalDate date2 = LocalDate.parse (str,format2); System.out.println ("date type:" + date2) }} the above is all the contents of the article "sample Analysis of string Interchange date types in java". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Date character string type article example analysis content not much most more knowledge industry information information channel channel reference learning help Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia Redmi Docker Apple