| 1. |
Solve : Comparing time as a string? |
|
Answer» Hello Experts, If you still need help I'd need to know between what times you'd want it to check. Because it's always before Midnight. Good point Delta. That code must be started manually every day I guess. Well if you're starting it manually it doesn't even need to check the time then, just the existence of the file.Quote from: DeltaSlaya on August 28, 2007, 03:36:21 PM Well if you're starting it manually it doesn't even need to check the time then, just the existence of the file. Yes it does, it has to wait around until the next midnight. Did you read the batch code at all? Oh, I see, so it's SUPPOSED to loop until the file arrives or the time is midnight? Thats easy enough.if that's the case, it would be simpler to just schedule a job at or after 12 midnight to query the existence of the file, instead of looping everytime.As it stands the code decides whether midnight has arrived by looking for "time /t" giving "12:00 AM" as an output. So strictly speaking it is not checking whether midnight has passed, it is checking if it is midnight "now". To be sure of not missing it the code needs to run continuously, which seems a bit inefficient to me. Although once every 30 seconds would still hit the window. More efficient and more elegant to check every once in a while whether midnight has gone past. A challenge might be the time format which depends on locale. (Americans like their AM / PM etc whereas we Euro weenies have our 24 hour format). So I'd store %date% as a string (e.g. set startdate=%date%) and just check every once in a while if it has changed yet (as it does at midnight every day). IF NOT "%startdate%"=="%date%" it's the next day. Quote from: ghostdog74 on August 29, 2007, 12:44:05 AM if that's the case, it would be simpler to just schedule a job at or after 12 midnight to query the existence of the file, instead of looping everytime. Simpler and more logical. |
|