Mapping time
in
Programming Questions
•
9 months ago
Hi,
I need help with 'mapping' time on a line. Related to time and flights/arrival and destination time.
For example, let's say time right now is: 15:30:00
The arrival time and the departure time are 14:00:00 and 17:30:00 respectively. As till now, for the time i have divided/splitted into H, M, and S like this-
The arrival time and the departure time are 14:00:00 and 17:30:00 respectively. As till now, for the time i have divided/splitted into H, M, and S like this-
(function inside class)-
- void getDepartureTime() {
- println(DepartureTime);
- int p = DepartureTime.length();
- String[] H = new String[p];
- String[] M = new String[p];
- String[] S = new String[p];
- int[] hours = new int[p];
- int[] minutes = new int[p];
- int[] seconds = new int[p];
- for(int k=0; k < p; k++) {
- String[] divide = split(DepartureTime, ":");
- H[k] = divide[0];
- M[k] = divide[1];
- S[k] = divide[2];
- }
- for(int k = 1; k < p; k++) {
- hours[k] = Integer.parseInt(H[k]);
- minutes[k] = Integer.parseInt(M[k]);
- seconds[k] = Integer.parseInt(S[k]);
- stroke(palette[4]);
- // map(hours[j], 0, 50, width/2, height);
- // line(width/2, height/2, hours[j]*40, minutes[j]*50);
- }
So, if i could draw a point on a line which signifies or maps the current time with respect to Arrival and destination time. I mean the point should be somewhere around 50% of the length of the line(as per the example which we took). It's the format (HH:MM:SS), which is confusing.
1