DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime time = LocalDateTime.now();
String localTime = df.format(time);
LocalDateTime ldt = LocalDateTime.parse("2017-09-28 17:07:05",df);
System.out.println("LocalDateTime转成String类型的时间:"+localTime);
System.out.println("String类型的时间转成LocalDateTime:"+ldt);

控制台结果:

LocalDateTime转成String类型的时间:2017-09-30 10:40:06
 String类型的时间转成LocalDateTime:2017-09-28T17:07:05

原文链接:http://blog.csdn.net/shaoyu_zhu_88/article/details/78140190

scala LocalDateTime String 转换的更多相关文章

  1. scala 时间格式转换(String、Long、Date)

    1)scala 时间格式转换(String.Long.Date) 1.时间字符类型转Date类型 [java] view plain copy import java.text.SimpleDateF ...

  2. Scala 深入浅出实战经典 第65讲:Scala中隐式转换内幕揭秘、最佳实践及其在Spark中的应用源码解析

    王家林亲授<DT大数据梦工厂>大数据实战视频 Scala 深入浅出实战经典(1-87讲)完整视频.PPT.代码下载:百度云盘:http://pan.baidu.com/s/1c0noOt6 ...

  3. scala 隐式转换

    先参考这篇文章:http://www.jianshu.com/p/a344914de895 package com.test.scalaw.test /** * scala隐式转换 */ object ...

  4. 在C#中将String转换成Enum:

    一:  在C#中将String转换成Enum: object Enum.Parse(System.Type enumType, string value, bool ignoreCase); 所以,我 ...

  5. C# 字符串string类型转换成DateTime类型 或者 string转换成DateTime?(字符串转换成可空日期类型)

    在c#中,string类型转换成DateTime类型是经常用到的,作为基本的知识,这里在此做个小结.一般来说可以使用多种方法进行转换,最常用的就是使用Convert.ToDateTime(string ...

  6. string转换成color转

    string转换成color             string col = "#FF8400";            this.BackColor = System.Draw ...

  7. C# 中怎么将string转换成int型

    int intA = 0;1.intA =int.Parse(str);2.int.TryParse(str, out intA);3.intA = Convert.ToInt32(str);以上都可 ...

  8. JAVA中List转换String,String转换List,Map转换String,String转换Map之间的转换类

    <pre name="code" class="java"></pre><pre name="code" cl ...

  9. string 转换char类型

    将string转换成char类型 const char *c = string.c_str() char转换string char *c_name = "char" string ...

随机推荐

  1. Python2在Sublime Text3中print中文时编译报错解决办法

    如果是用记事本新建的python文件,有可能是由于记事本默认的ascii格式导致的,这个时候只需要在Sublime Text3中   文件->设置文件编码(utf-8),保存即可.这样能够解决的 ...

  2. Delphi xe---FIREDAC

    delphi  xe 10.2 完成FireDAC支持NoSQL MongoDB数据库,包括新FireDAC MongoDB,包括新FireDAC MongoDB的驱动.

  3. Sending 'ccColor4B' (aka 'struct_ccColor4B') to parameter of incompatible type

    今天遇到了如下的一个错误, Sending 'ccColor4B' (aka 'struct_ccColor4B') to parameter of incompatible type CiColor ...

  4. 转!! Eclipse设定和修改文件字符编码格式和换行符

    Window -> Preferences -> General -> Workspace : Text file encoding :Default : 选择此项将设定文件为系统默 ...

  5. C#HTML与UBB(纯文本)之间的转换

    private string HtmlToUBB(string _Html)         {            _Html = Regex.Replace(_Html,"<br ...

  6. STL中使用reverse_iterator时,如何正确使用erase函数

    假设有一个list容器,顺序存储了0-9一个10个整数.现在要使用reverse_iterator迭代器来查找值为8和5的元素,并且将这两个数删除.先来看以下的解决方法: #include <i ...

  7. 流畅的python 字典和集合

    介绍 dict 类型不但在各种程序里广泛使用,它也是 Python 语言的基石.模块的命名空间.实例的属性和函数的关键字参数中都可以看到字典的身影.跟它有关的内置函数都在 __builtins__._ ...

  8. Redis一(Redis-py与String操作)

    Redis 介绍 redis是一个key-value存储系统.和Memcached类似,它支持存储的value类型相对更多,包括string(字符串).list(链表).set(集合).zset(so ...

  9. js验证真实姓名

    var regName = /^[\u4e00-\u9fa5]{2,4}$/; if (!regName.test(examinee.name)) { wx.showToast({ title: &q ...

  10. Spring Data Jpa示例(IntelliJ maven项目)

    1. 在IntelliJ中新建maven项目 给出一个建好的示例,(本示例中省略了业务逻辑组件UserService) 2. 在pom.xml中配置依赖 包括: spring-context spri ...