[Resolved] Date Format to parse date string from Bubble - Android app crash


#1

In an Android app I am retrieving a date string from a user record via Bubble API and trying to use ‘Create a Date from Date Time String’ to create the Timestamp value in the app. The string represents the ‘Member Start Date’ for a user.

I have set the ‘Date Format’ as EEE MMM dd HH:mm:ss 'GMT’z yyyy in the ‘Create a Date from Date Time String’ Action and this has been working fine until recently as Bubble sends the date as ‘Sun Oct 20 16:39:00 GMT+1:00 2019’ and the ‘z’ after GMT is dealing with the ‘+1:00’ in the parsing.

However, following Daylight Saving Time changes last weekend we are now at GMT+0:00 in the UK and I’m now seeing newly created dates from Bubble as ‘Thu Oct 31 16:13:54 GMT 2019’, ie no + or - hours after GMT.

This unfortunately is causing the Android app to crash when it tries to execute the ‘Create a Date…’ Action on both the Emulator in Android Studio and on a physical Android device (but not in the Dropsource Nexus 5 emulator strangely).

Does anybody know if there is a ‘Date Format’ that can be used to parse the date string from Bubble which will handle both the inclusion and exclusion of the ‘+h:00’ characters after GMT?

Thanks


#2

Resolution is to replace 'GMT’z in the ‘Date Format’ string with Z (i.e capital z).

Therefore, for an Android app the ‘Date Format’ entry in a ‘Create a Date from Date Time String’ for a Bubble date value should be ‘EEE MMM dd HH:mm:ss Z yyyy’
This will allow you to process Bubble date values correctly to a Timestamp irrespective of whether they have +h:00 value after GMT from Bubble or not.


#3

Ahh Great catch @daveg_47. Thanks for sharing the solution as well. This is a subtle but critical adjustment.