-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
106b5fe
commit 6214422
Showing
2 changed files
with
42 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
int getTimeZone(String date){ | ||
int month = getMonth(date, '-', 1).toInt(); | ||
|
||
if(month > 3 && month < 11){ | ||
return 1; | ||
} | ||
return 0; | ||
} | ||
|
||
|
||
String getMonth(String data, char separator, int index){ | ||
int found = 0; | ||
int strIndex[] = { 0, -1 }; | ||
int maxIndex = data.length() - 1; | ||
|
||
for (int i = 0; i <= maxIndex && found <= index; i++) { | ||
if (data.charAt(i) == separator || i == maxIndex) { | ||
found++; | ||
strIndex[0] = strIndex[1] + 1; | ||
strIndex[1] = (i == maxIndex) ? i+1 : i; | ||
} | ||
} | ||
return found > index ? data.substring(strIndex[0], strIndex[1]) : ""; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters