I have an ISO 8601 date string in the following format:
String myIsoDateString = "2019-02-27T23:00:00.000Z"
I need to use the date string as part of a query I'm running in BigQuery. I'm trying to use the com.google.cloud.bigquery.QueryParameterValue
class to convert it to a QueryParameterValue
, with a type of timestamp
, like this:
QueryParameterValue.timestamp(myIsoDateString)
This gives me an error:
java.lang.IllegalArgumentException: Invalid format: "2019-02-27T23:00:00.000Z" is malformed at "T23:00:00.000Z"
The inline help in Eclipse for the timestamp method states that it:
Creates a QueryParameterValue object with a type of TIMESTAMP. Must be in the format"yyyy-MM-dd HH:mm:ss.SSSSSSZZ", e.g. "2014-08-19 12:41:35.220000+00:00".
How do I convert myIsoDateString
to the required format? Is there a better method I can use that will handle converting from an ISO 8601 string to a timestamp in BigQuery?
T
with a space? – Tweeze