Local DateTime - Convert Firestore timestamp to Local Date , Time & Timezone

Custom Code

I am trying to convert Firestore timestamp to Local Date , Time & Timezone. The below code as 2024-8-13 13:33:01

Issues with above conversion:

  1. Timezone - No Time zone information displayed. I have used the "Z" flag DateFormat('yyyy-MM-dd HH:mm:ss Z').format(localDateTime); Still i dont see timezone information

  2. VPN - I tried opening the link using a VPN and simulating that I am in Netherlands. However, it still displayes the time as 13:33:01 (which is time in IST) , it should switch to Netherland timezone: https://aisqlgeneratorlemonslow.flutterflow.app/settings

How do i go about displaying timestamp stored in Firestore database on FlutterFlow front end , converting it to the timezone local to the user??

String? convertFirestoreDateTimeToLocal(DateTime? subscriptionRenewsAt) {
  /// MODIFY CODE ONLY BELOW THIS LINE

  if (subscriptionRenewsAt == null) {
    return null;
  }
  DateTime localDateTime = subscriptionRenewsAt.toLocal();
  return DateFormat('yyyy-MM-dd HH:mm:ss Z').format(localDateTime);

  /// MODIFY CODE ONLY ABOVE THIS LINE
}
What have you tried so far?

Custom Function as pasted above

Did you check FlutterFlow's Documentation for this topic?
No
2
1 reply