What do you need to send? The localtime component or the UTC component?
If you want to use localtime and your API accepts the datetime as a string, you could use formatDateTime to force the system to use localtime.
If you need to have it as DateTime, you can use a combination of parseDateTimeUTC and formatDateTime to store your local time as utc.
parseDateTimeUTC(formatDateTime(<YourDateTime>)) //for example. If you need to have a specific accuracy, you may want to add a format string
If you have a location (latitude and longitude), you can use the google Time zone API to get the current offset for that location with respect to UTC time.
Then you can add the offset to your stored local time to get a value that you can compare against CurrentDateTime.
https://developers.google.com/maps/documentation/timezone/start
-Andrej
My approach is to set my DateTime attributes to localize = false.
Since in most cases the offset between regions doesn't matter at all.
By doing this, the show DateTime equals the DB stored DateTime = UTC. Which solves a lot of issues.
FYI: the DateTime is always stored UTC, but presented in server, app, or user timezone depending on setting.
More tips: https://docs.mendix.com/refguide/datetime-handling-faq