Here's a sample vbscript to use in Custom Inventory for Windows to convert a datetime stamp to NSDatetime format. It doesn't have all possible error checking, but it does have the main conversion logic. The entire vbscript will create an NSI file directly.
Attribute definition: objTextFile.WriteLine("<s:AttributeType name=""c1"" rs:name=""DateCreated"" rs:number=""2"" rs:keycolumn=""true"" mifAttrId='2'>") objTextFile.WriteLine(" <s:datatype dt:type=""dateTime""/>") objTextFile.WriteLine("</s:AttributeType>") Call to function in rs:data section: "c1=""" + nsDate(CStr(objFile.DateCreated)) + """" _ Function to convert the date: function nsDate(curDate) 'remove " AM" and " PM" from the end of the value cd = Mid(curDate,1,len(curDate)-3) 'Separate date & time values pos=InStr(cd," ") dt = Mid(cd,1,pos) tm = Mid(cd,pos+1,len(dt)) 'Separate year, month & date portions of the date value posa = InStr(dt,"/") posb = InStr(posa+1,dt,"/",1) mm = Mid(dt,1,posa-1) dd = Mid(dt,posa+1,posb-posa-1) yy = RTrim(Mid(dt,posb+1,len(dt))) if len(mm) = 1 then mm = "0" & mm end if if len(dd) = 1 then dd = "0" & dd end if 'Separate hour, minute & second portions of the time value posa = InStr(tm,":") posb = InStr(posa+1,tm,":",1) hh = Mid(tm,1,posa-1) mi = Mid(tm,posa+1,posb-posa-1) ss = RTrim(Mid(tm,posb+1,len(tm))) if len(hh) = 1 then hh = "0" & hh end if if len(mi) = 1 then mi = "0" & mi end if if len(ss) = 1 then ss = "0" & ss end if 'Rebuild the date in nsdate format (CCYY-MM-DDTHH:MM:SS) nsDate = yy & "-" & mm & "-" & dd & "T" & hh & ":" & mi & ":" & ss end function 'convertDate
A complete sample of this vbscript can be found here.