Rev 103 | Rev 115 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
'''Created on 26-Mar-2010@author: ashish'''import datetimeimport timefrom shop2020.utils import OrderStatusstatus_active = 0status_retired = 1status_deleted = 2status_paused = 3status_added = 4def to_py_date(java_timestamp):seconds = java_timestamp / 1000sub_seconds = (java_timestamp % 1000.0) / 1000.0date = datetime.datetime.fromtimestamp(seconds + sub_seconds)return datedef to_java_date(py_timestamp):return int(time.mktime(py_timestamp.timetuple())) * 1000 + py_timestamp.microsecond / 1000def get_status_fdate_tdate(status, from_date, to_date):current_from_date = ""current_to_date = ""current_status = ""if status:current_status = OrderStatus.get_c_status(status)if from_date:current_from_date = to_py_date(from_date)if to_date:current_to_date = to_py_date(to_date)return current_status, current_from_date, current_to_date