-
Notifications
You must be signed in to change notification settings - Fork 865
The field LastModified field for the s3Object is not in GMT from C# as described in the docs #1885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi @screig, Good morning. Based on my testing, the using System;
using Amazon.S3;
using Amazon.S3.Model;
namespace S3GetObjectTest
{
class Program
{
private static string bucketName = "bucket_name";
static void Main(string[] args)
{
var s3Client = new AmazonS3Client();
var listObjectResponse = s3Client.ListObjectsAsync(new ListObjectsRequest() {
BucketName= bucketName
}).Result;
foreach(var s3Object in listObjectResponse.S3Objects)
{
Console.WriteLine($"Key: {s3Object.Key}, LastModified: {s3Object.LastModified}");
}
}
}
} produces the following output in Debug window: Notice the Also refer https://en.wikipedia.org/wiki/ISO_8601. ISO 8601 format can be used to represent local or UTC time. In our case, it's represented in local time. Hope this helps. Thanks, |
Hi The AWS docs do state that the time should be in GMT, no?
|
@screig The docs state that the GMT formatted date is passed to user, but this is on the HTTP response stream. The date in C# is represented as normal |
I have no idea why you are bringing strings in to this? Are you suggesting that the DateTime object cannot hold the timezone information. Using your example, both of these "normal DateTime objects", no? The first one has the time as GMT(UTC) as per the docs and it storing the tz. The docs says it should return a DateTime object and that it should be in the GMT(UTC) timezone. This function currently does not do that, that is a bug. That's simply a fact. Even now I don't know what the local timezone is. Is it the local time of the insertion region or the local time of the extraction region? This function should a DateTime object with contents like the one below. Where the time is in UTC and the tz is set in "Kind" member as UTC. Where as I mentioned before GMT=UTC. Please fix this. Or change the docs. |
Could be similar as #1224 |
Here's the problem spot, which I found while investigating this issue for my previous report (#1224). This aws-sdk-net/sdk/src/Core/Amazon.Runtime/Internal/Transform/SimpleTypeUnmarshaller.cs Line 399 in 08c86fc
|
I have verified this issue and other DateTime issues have been corrected in 4.0.0.0-preview.5 released today: https://github.com/aws/aws-sdk-net/releases/tag/4.0.0.0-preview.5 The changes were made in AWS SDK for .NET version 4 because of the number of breaking changes required to fix DateTime handling. This PR details all the changes made to the SDK's DateTime handling to ensure AWS SDK for .NET is UTC first: #3572 Please give preview 5 a try if you are able to do so. |
Description
Interrogate an s3 bucket using the AWSSDK.S3 C# nuget package, the LastModifed times you get back are not in UTC (GMT). The times are in fact in some unknown timezone.
https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/S3/TS3Object.html
Reproduction Steps
Query a bucket and some file from two different regions, if the time was truly in UTC then the LastModified value would be the same. Here is the code where I print the times out of some bucket.
Logs
here I am running the code in London
And here in the US
Note how the last modified time is different by five hours. So it is not GMT, but in some unknown timezone. If I at least knew the timezone I could convert it to GMT.
Environment
Resolution
This is a 🐛 bug-report
The text was updated successfully, but these errors were encountered: