How to Get Date Time for Specific Timezone and Date in Specific Format

The below code for gets datetime for the New Zealand timezone. For more information on DateTime and available Timezones, please check our API.

def todayDateTime = new DateTime() def nzTimeZone = api.getTimeZone("NZ") def todayText = todayDateTime.withZone(nzTimeZone).toString("yyyy-MM-dd")

Found an issue in documentation? Write to us.