formatDateInTimeZone static method

String formatDateInTimeZone(
  1. DateTime dateTime
)

Implementation

static String formatDateInTimeZone(DateTime dateTime) {
  // Convert to the desired time zone (for example, UTC+7)
  final utcDateTime = dateTime.toUtc();
  const timeZoneOffset = Duration(hours: 7); // Offset for UTC+7
  final localDateTime = utcDateTime.add(timeZoneOffset);

  // Format the date-time
  final formatter = DateFormat("dd MMM yyyy, hh:mm a");
  return formatter.format(localDateTime);
}