ThriftIDLには日付表現はないと思います。プロジェクトではこの表記を使用します。
typedef string Timestamp
次に、このようなタイムスタンプの使用が必要な後続のモデルでその表記を使用します
struct blah{
/**
* TODO:list what notation this dateTime represents. eg ISO-8601
* or if its in the format like YYYY-mm-DD you mentioned.
*/
1:Timestamp dateTime;
}
文字列を使用すると、 JODA操作を簡単に使用できます
- 編集 -
保存するタイムスタンプがわかりません。たとえば、トランザクションが発生した現在のインスタンスを計算し、それをそのthriftオブジェクトに格納する場合は、Jodaを使用してこれを行うことができます。
String timestamp = new DateTime().toString("YYYY-MM-dd"); //2013-03-26 This will be string value generated. It will convert the current time to format you seek to output.
//Use the generated thrift object.
Blah newblah = new Blah();
blah.setDateTime(timestamp);