how to represent date type in apache thrift -


i'm developing service using apache thrift , need define periods of time. dates significant (yyyy-mm-dd) , time should totally omitted (hh:ii:ss). couldn't find specific date/datetime thrift data type i'm thinking 2 approaches:

  1. more complex

    int year, int month, int day, 
  2. less complex includes time of day part don't need.

    int timestamp 

is there common thrift approach represent date(time) types?

i don't think there date representation on thrift idl. use notation our projects.

typedef string timestamp; 

then use notation on subsequent model needs timestamp usage this

struct blah{      /**     * todo:list notation datetime represents. eg iso-8601     * or if in format yyyy-mm-dd mentioned.     */     1:timestamp datetime;      } 

string makes easier use joda operations

--edit--

i don't know timestamp intend store. instance if want calculate current instance transaction has occurred , store thrift object, can joda.

    string timestamp = new datetime().tostring("yyyy-mm-dd"); //2013-03-26 string value generated. convert current time format seek output.     //use generated thrift object.     blah newblah = new blah();     blah.setdatetime(timestamp); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -