Calendar Constructor Java toString

前端 未结 5 1448
天命终不由人
天命终不由人 2021-01-21 01:30

What I\'m trying to do is pass a date into the Calendar so that it will format the date ready for use with another constructor. So that i can make use of it later using the func

5条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-21 02:25

    Assuming DateD is Calendar , it is default toString() implementation. You need to call getTime() to get the date out of it.

    From the java doc of Calendar#toString()

    Return a string representation of this calendar. This method is intended to be used only for debugging purposes, and the format of the returned string may vary between implementations. The returned string may be empty but may not be null.

    You can use SimpleDateFormat to convert it to String

提交回复
热议问题