'How to Print with Plistbuddy and force String decoding?

I'm using plistbuddy in a script to pull a date/time stamp from a plist. The format of the date/time in the plist is as follows:

<key>LastCheckin</key>
<date>2022-05-05T00:47:03Z</date>

Pertinent line from the script:

parsedCheckin=$(/usr/libexec/PlistBuddy -c "Print LastCheckin" /dev/stdin <<<"$plist")

The trouble is, the output of that script looks like this:

Wed May 04 20:47:03 EST 2022

It seems that plistbuddy is too smart for its own good, and converts the date/time to my computer's local timezone settings; but I'd really like the output to be in GMT. Now, I can probably pass the output through the date binary, but I'm really hoping that I can just either:

  1. Force plistbuddy to output the date in a specific timezone (GMT)
  2. Force plistbuddy to ignore the fact that this key is a date and just give me the raw string value

Any advice is greatly appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source