【发布时间】:2012-10-18 13:31:56
【问题描述】:
我有执行以下操作的 C# 代码:
DateTime now = DateTime.UtcNow;
string timeToOutput = now.ToString();
String pathInStorage = now.ToString("yyyy-MM-dd/HH/");
CloudBlobClient client = getClient();
CloudBlobContainer container = client.GetContainerReference(hardcodedContainerName);
container.GetBlobReference(pathInStorage).UploadText(timeToOutput);
如您所见,我首先获取当前时间,然后使用不同的格式字符串对其进行两次格式化。现在大多数情况下,存储中的路径将匹配到 blob 本身的时间输出。
但有时(很少)blob 中的时间是 2012 年(如 2012 年 10 月 29 日 12:33:00),但路径将包含 2555 年,小时-日-月将与内部时间相匹配blob(如 2555-10-29-12)。
怎么会这样?
【问题讨论】:
-
now变量的确切值是多少?
标签: c# .net datetime azure azure-storage