26 April, 2012

FIM 2010: Datetime formatting

When you are writing to the FIM WebService and setting datetime values; these values needs to be formatting a specific way, otherwise you gain a very descriptive (!) exception (UnvillingToPerformException).

The format is the ISO 8601 format: yyyy-MM-ddTHH:mm:ss.fff

So to write a datetime field in .NET; you use this syntax:

new CreateRequestParameter("ValidFromDate", DateTime.Now.ToUniveralTime().ToString("’yyyy'-'MM'-'dd'T'HH':'mm':'ss'.000'"))

That’s what it takes.

Note: It is always a good idea to convert datetime fields into UTC-time. The FIM Portal will handle the needed display conversion into desired display (using either the Portals or the Users TimeZoneConfiguration).

Update: It seems it’s sufficient to call .ToUniversalTime() to get the proper formatting? At least that what I’ve been having success with recently.

StackOverflow Tags:

No comments:

iPhone/XCode - not all cases are equal!

This bit me! Having made some changes to an iPhone application (Obj-C); everything worked fine in the simulator. But, when deploying the s...