Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何在创建 REST 服务时在 UriTemplate 和 Url 中传递 DateTime 参数(即 datatype=DateTime)?示例:如果我想在 UriTemplate 和 serviceUrl 中将日期作为 9/17/2012 传递,那么该怎么做?
我能够成功使用的唯一日期格式是 Unix Epoch 格式。例如,要发送31Dec2012 05:00:00,我会发送1356930000000
31Dec2012 05:00:00
1356930000000
如果您使用的是 javascript,这是我们从getTime()日期变量的函数中获得的值:
getTime()
var milliseconds = (new Date).getTime();
WCF Web 服务接受此值并成功转换为日期时间。
以下程序使用 VC++ 2012 编译。
#include <algorithm> struct A { A() : a() {} bool operator <(const A& other) const { return a <= other.a;