I have a Text box Infopath that displays the current time using this function:
(substring-after(now(), “T”)
I also have a Drop-Down list called “Location” that has the following values:
1.Boston
2.India
3.London
I want to modify this function to set the current time to always display the current time in Boston whether the user is from India or London.
I believe that inputting an If Statement that follows these conditions:
-
If Location (Drop down list) = “London” – Then use (substring-after(now(), “T”) subtracted by 5 hours.
-
If Location (Drop down list) = “India” – Then use (substring-after(now(), “T”) subtracted by 11 hours.
-
If Location (Drop down list) = “Boston” – Then use (substring-after(now(), “T”).
I’m relatively new to Xpath and require assistance.
The easiest way is to subtract the hours before ripping the time off the end with substring.
WARNING: Remember the current time (
now()) is calculated from the LOCAL machine. So if a person in London opens the form they will already be at London time and then your code will subtract 5 hours on top of that – making it incorrect.