Curl Global Community

Full Version: CDate型への変換について
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
下記の変換を行いたいのですが、どのようにすればよいでしょうか。
・DateTime型→CDate型
・String型(yyyymmdd)→CDate型

CDateのインスタンス生成時に、引数としてDataTime.date.partial-secondまたはepoch-second
を使用するのかとも考えましたがうまく変換されません。
変換してくれるメソッド等が準備されているのであれば、ご教示ください。
文字列は、CDate.value-of でいけそうですが、
デフォルトコンストラクタに渡す値はワカリマセン。


Code:
{def str = "2015-03-06"}
{def c = {CDate.value-of str}}
{Table columns = 2
    ,"String", str
    ,"time", cd.time
    ,"to-DateTime", {cd.to-DateTime}
    ,"to-GMTDateTime", {cd.to-GMTDateTime}
    ,"to-GMTString", {cd.to-GMTString}
    ,"to-LocaleDateTime", {cd.to-LocaleDateTime}
    ,"to-String", {cd.to-String}
    ,"to-String-for-GMT", {cd.to-String-for-GMT}
}