Convert Date to XML Date/Time Format

Converting a date such as 1/21/2008 11:09:05 AM to XML Date/Time Format.
You might want to put this code into a MapHelper library, then reference
it from a Scripting Functoid in a BizTalk Map.

[[code]]czo0MzI6XCIKICAgICAgICBwdWJsaWMgc3RhdGljIHN0cmluZyBDb252ZXJ0RGF0ZVRpbWV0b1htbERhdGVUaW1lKHN0cmluZyBpbkR7WyYqJl19YXRlKQogICAgICAgIHsKICAgICAgICAgICAgdHJ5CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIERhdGVUaW1lIGR0SW4gPXtbJiomXX0gRGF0ZVRpbWUuUGFyc2UoaW5EYXRlKTsKICAgICAgICAgICAgICAgIHJldHVybiBTeXN0ZW0uWG1sLlhtbENvbnZlcnQuVG9TdHJpe1smKiZdfW5nKGR0SW4sIFN5c3RlbS5YbWwuWG1sRGF0ZVRpbWVTZXJpYWxpemF0aW9uTW9kZS5Mb2NhbCk7CgogICAgICAgICAgICB9CiAgICB7WyYqJl19ICAgICAgICBjYXRjaAogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICByZXR1cm4gXCJpbnZhbGlkLURhdGUvVGltZS1jb252ZXJ7WyYqJl19c2lvbiBmcm9tIHZhbHVlPVwnXCIgKyBpbkRhdGUgKyBcIlwnXCI7CiAgICAgICAgICAgIH0KICAgICAgICB9ClwiO3tbJiomXX0=[[/code]]

Leave a Reply

Recent Posts

Archives

Categories

Meta

All Rights Reserved Theme by 404 THEME.