February 20, 2009
Date and Time to Number Conversions
Code developed and kindly donated by Murthy Suresh.
{ dd_ = StrToNum( StrRight( aaaammdd, 2 ) ); //printf(WriteVal(dd_) + " " ); mm_ = StrToNum( StrMid( aaaammdd, 4, 2 ) ); //printf(WriteVal(mm_) + " " ); aa_ = StrToNum( StrLeft( aaaammdd, 4 ) ); //printf(WriteVal(aa_) + " " + "\n" ); Date_Num = ( 10000 * ( aa_ - 1900 ) ) + ( 100 * mm_ ) + dd_; RESULT = Date_Num; return RESULT; } function Time_To_Num( strTime ) // format for time is hh:mm:ss { /* //do something to raise alert if length does not match ????PopupWindow("Current time is: " + Now(),"Alert", 2, 640*mtRandom(), 480*mtRandom()); */ hh_t = StrToNum( StrLeft( strTime, 2 ) ); //printf(WriteVal( hh_t ) + " " ); mm_t = StrToNum( StrMid( strTime, 3, 2 ) ); //printf(WriteVal( mm_t ) + " " ); ss_t = StrToNum( StrRight( strTime, 2 ) ); //printf(WriteVal( ss_t ) + " " + "\n" ); Time_Num = 10000 * hh_t + 100 * mm_t + ss_t; RESULT = Time_Num; return RESULT;
Filed by Herman at 11:13 pm under AFL - Utilities and Functions,Uncategorized
Comments Off on Date and Time to Number Conversions