我想使用以下格式获取截断日期:
20190326
此代码在我的架构中:
dateCreated: {
type: Date,
default: Date.now
}
2019-03-26T01:05:43.778Z
答案 0 :(得分:0)
db.collection.aggregate([{
$project: {
date: {
$dateToString: {
format: "%d%m%Y",
date: "$dateCreated"
}
}
}
}])
您可以根据需要设置甲壳。 样本数据here。
答案 1 :(得分:0)
这解决了它:
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 2 MSBuild instance(s)
1: Visual Studio Community 2019 16.0.28714.193 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"
2: StandAlone 15.0 - "c:\Users\JPB\.vscode\extensions\ms-vscode.csharp-1.17.1\.omnisharp\1.32.8\msbuild\15.0\Bin"
[info]: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: Visual Studio Community 2019 16.0.28714.193 - "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin"