scala提取字符串中数字_如何在Scala中以字符串或数字的形式获取日期,月份和年份?...

scala提取字符串中数字

The "calendar" class handles working with date and time in Scala, the class generates the current time in the following format,

“ calendar”类处理Scala中的日期和时间 ,该类以以下格式生成当前时间,

    Thu Apr 23 06:10:37 GMT 2020

We can extract different parts like date, month, and year.

我们可以提取日期,月份和年份等不同部分。

计划在Scala中获取日期 (Program to get date in Scala)

import java.util.Calendar
import java.text.SimpleDateFormat

object MyClass {
   
    def main(args: Array[String]) {
   
        val cal = Calendar.getInstance
        val dateTime = cal.getTime
        
        println("Full date information : " + dateTime)
        
        val dateFormat = new SimpleDateFormat
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值