internal static DateTime? ParseExpiresHeader(string rawValue, string requestId)
{
if (!string.IsNullOrEmpty(rawValue))
{
try
{
return S3Transforms.ToDateTime(rawValue);
}
catch (FormatException e)
{
throw new AmazonDateTimeUnmarshallingException(
requestId,
string.Empty,
string.Empty,
rawValue,
message: string.Format(
CultureInfo.InvariantCulture,
"The value {0} cannot be converted to a DateTime instance.",
rawValue),
innerException: e);
}
}
else
{
return default(DateTime);
}
}