I do this sort of thing all the time, but with TRANSLATE (and before anyone leaps on me, these are code snippets, not a whole program :-) :
LeadHours = 48 * 60 /* actually LeadMinutes :-) */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Convert incoming dates from DD/MM/YYYY to YYYYMMDD |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
MinStDate = Translate('56783412',RF.StrtDate,'12/34/5678')
MinEnDate = Translate('56783412',RF.EndDate,'12/34/5678')
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Extract hours and minutes from start and end times |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
Parse Var RF.StrtTime MinStHH ':' MinStMM
Parse Var RF.EndTime MinEnHH ':' MinEnMM
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Calculate start and end times in minutes since midnight |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
MinStTime = MinStHH * 60 + MinStMM
MinEnTime = MinEnHH * 60 + MinEnMM
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| WindowStart = TaskStartDate + TaskStartTime - Lead time |
| WindowEnd = TaskEndDate in minutes + end time |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
WindowStart = Date('B',MinStDate,'S') * 1440 + MinStTime - LeadHours
WindowEnd = Date('B',MinEnDate,'S') * 1440 + MinEnTime
--
Andy Styles
Lloyds TSB Bank plc. Registered Office: 25 Gresham Street, London EC2V 7HN. Registered in England and Wales, number 2065. Telephone: 020 7626 1500.
Bank of Scotland plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 327000. Telephone: 020 7626 1500.
Lloyds TSB Scotland plc. Registered Office: Henry Duncan House, 120 George Street, Edinburgh EH2 4LH. Registered in Scotland, number 95237. Telephone: 0131 225 4555.
Cheltenham & Gloucester plc. Registered Office: Barnett Way, Gloucester GL4 3RL. Registered in England and Wales, number 2299428. Telephone: 01452 372372.
Lloyds TSB Bank plc, Lloyds TSB Scotland plc, Bank of Scotland plc and Cheltenham & Gloucester plc are authorised and regulated by the Financial Services Authority.
Halifax is a division of Bank of Scotland plc. Cheltenham & Gloucester Savings is a division of Lloyds TSB Bank plc.
HBOS plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 218813. Telephone: 020 7626 1500.
Lloyds Banking Group plc. Registered Office: The Mound, Edinburgh EH1 1YZ. Registered in Scotland, number 95000. Telephone: 0131 225 4555
This e-mail (including any attachments) is private and confidential and may contain privileged material. If you have received this e-mail in error, please notify the sender and delete it (including any attachments) immediately. You must not copy, distribute, disclose or use any of the information in it or any attachments.
Telephone calls may be monitored or recorded.