Get Timestamp with Azure BlobStorage Java SDK

It's as simple as getting a timestamp for an Azure Blob Storage object, but it's surprisingly annoying, so make a note of it. I think it is natural to give a time stamp to the object of BlobItem, but it seems that the design concept is different.

Maven POM

<!-- https://mvnrepository.com/artifact/com.microsoft.azure/azure-storage -->
<dependency>
	<groupId>com.microsoft.azure</groupId>
	<artifactId>azure-storage</artifactId>
	<version>8.4.0</version>
</dependency>

Code

import com.microsoft.azure.storage.*;
import com.microsoft.azure.storage.blob.*;

public class AzureHello {
	public static final String storageConnectionString = "{your_connection_string}";

	public static void main(String[] args) {
		CloudStorageAccount storageAccount;
		CloudBlobClient blobClient = null;
		CloudBlobContainer container = null;

		try {
			storageAccount = CloudStorageAccount.parse(storageConnectionString);
			blobClient = storageAccount.createCloudBlobClient();
			container = blobClient.getContainerReference("{your_container_name}");
			CloudBlob cb = container.getBlobReferenceFromServer("test.txt");
			System.err.println(cb.getProperties().getLastModified());
		...
		}
	}
}

Recommended Posts

Get Timestamp with Azure BlobStorage Java SDK
Use aggregate queries (Count) with Azure CosmosDB Java SDK
Append text to BlobItem in Azure BlobStorage SDK Java V8
Use Azure Bing SpellCheck with Java
[Java] Get List / Map elements with Iterator
[Java] Get the date with the LocalDateTime class
Get a list of S3 files with ListObjectsV2Request (AWS SDK for Java)
Upsert from Java SDK to Azure Cosmos DB
Deploy Java web app to Azure with maven
[Java] Get images with Google Custom Search API
[LeJOS] Get EV3 sensor value remotely with Java
Select * from Java SDK to Azure Cosmos DB
Get along with Java containers in Cloud Run
Delete All from Java SDK in Azure Cosmos DB
Experienced Java users get started with Android application development
Search by POST request with Azure Search + Java Apache HttpClient
[Java] Get the date 10 days later with the Calendar class
I dealt with Azure Functions not working in Java
Get S3 object size with AWS SDK for Ruby
I want to get along with Map [Java beginner]
Get started with serverless Java with the lightweight framework Micronaut!
Install java with Homebrew
[Java] Get miscellaneous dates
Change seats with java
Install Java with Ansible
Azure functions in java
Switch java with direnv
[Java] Initialize, add, get
Download Java with Ansible
Let's scrape with Java! !!
Build Java with Wercker
Get started with Gradle
Endian conversion with JAVA
[Java] Get Charset with Apathce Tika / Initialize String from Charset [Kotlin]
First year Java developers on udemy get started with PHP
Investigated how to call services with Watson SDK for Java