Help Debugging a Series of Conditions Dealing with DateTime

Split from: how to make cluster on map of nearest 1 or 2 locations depending upon radius/distance

i have 3 condition of time in if loops but in any case code is not executing in that condition giving only one output [1] "Enter Valid Time" please guide why loop is not runing i am giving the following input of time :-
" 2020-3-29 15:00:00 PST"

deltime=readline(prompt="Please enter deliery date and time\t")       # for input of date and time
T=as.POSIXlt.character(deltime)                                          # to pass the time in formate R accepts
if(Sys.time()+60*30 < T){
}else if(Sys.time()+60*30==T){
  print(paste("Cost for dedicated veh",loc,totalcostfordedvehs))}
}else if(Sys.time()+60*30>T){
  print("Enter Valid Time")

this code has 2 definite problems and 1 possible further problem

  1. you have one more closing curly bracket than opening curly brackets.
    its the one after totalcostfordedvehs
  2. readline works interactively, so you cant use the 'source' button to send all your code to the console. , however wrapping it in a function, that you call interactively would work though
  3. *possible - variables mentioned that you may or may not have in your environment

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.