Kent Belan wrote on 2015-10-02: > Happy Friday, > > Has anyone successfully used the DBI ctTree control to create a datetime > column that is sortable ?? > > This thing is so weird to load. The column requires a double precision > number that represents the date and time. The integer part is the date and > the decimal part is the time. > > I have the date part working ok, but not so much luck on the time part. > > Here is the help text: > If this property is equal to 0 (Text), the data type a string value, else a > numeric value is required. > > DBI date / time components are stored as a double-precision, floating-point > number (up to 15 decimal places). The integer portion of the > double-precision number represents the date; the decimal portion represents > the time. A date value of 0 represents December 30, 1899 or January 1, 1900 > depending on your development platform. The time values range from .0 > (00:00:00) to .99999 (23:59:59). The numeric value represents a fraction of > one day. To assign date and time values to a component the developer must > convert the date value or the time value to a long integer and then assign > it to the component. > > So what I have so far is: > > ltSentdate = datetime() > > lcTime = right(ttoc(ltSentdate,1),6) > > lnSent = val(lcTime) / 235959 > > it is close but not correct ... The time should be 10:58:36 AM but I the DBI > datetime column is displaying the time as 10:45:54 AM > > I guess I don't have the correct calculation for the time ???? > > Any help is greatly appreciated > > Thanks, > Kent
Kent, Reading the documentation you provided, this is how I would get the decimal section: SET DECIMALS TO 5 ltSentDate = DATETIME(2015,10,01,23,59,59) lnSeconds = ((HOUR(ltSentDate) * 3600) + (MINUTE(ltSentDate) * 60) + SEC(ltSentDate)) / 86400 ?lnSeconds Tracy Pearson PowerChurch Software _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/[email protected] ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

