问题
How i can change date and time format? I need replace ":" to "_" in time. Below my code:
<SetProperty Before='AppSearch' Sequence='both' Id='HOSTNAME' Value="[ComputerName]_[Time]_[Date]">NOT HOSTNAME</SetProperty>
回答1:
The MSI SDK documents this pretty well: Time Property:
The format of the value depends upon the user's locale, and is the format obtained using GetTimeFormat function with the TIME_FORCE24HOURFORMAT | TIME_NOTIMEMARKER
option.
So the user's locale will affect the format, and then you probably need to use a custom action to get the formatting the way you want it. I can't think of any other way to do it.
All time silliest VBScript: (it is very late)
MsgBox Day(Now) & "_" & Month(Now) & "_" & Year(Now) & "_" & Hour(Now) & "_" & Minute(Now) & "_" & Second(Now)
And just a hint for how to insert custom actions can be found here: How to execute conditional custom action on install and modify only?
- https://ss64.com/vb/syntax-getdatetime.html
- https://ss64.com/vb/syntax-getdate.html
- https://www.w3schools.com/asp/asp_ref_vbscript_functions.asp
- How do I get the Date & Time (VBS)
来源:https://stackoverflow.com/questions/53773242/wix-setproperty-before-appsearch