在Excel/VBA中检查PC日期区域
是否有任何VBA功能允许我检查PC日期格式(区域设置)。这是在控制面板->区域和语言中设置的在Excel/VBA中检查PC日期区域,vba,excel,Vba,Excel,是否有任何VBA功能允许我检查PC日期格式(区域设置)。这是在控制面板->区域和语言中设置的 Michael几年前我发现了这个,我用它来检查地区日期格式: Function DateFormat() As String DateFormat = CStr(DateSerial(1999, 1, 2)) DateFormat = Replace(DateFormat, "1999", "YYYY") DateFormat = Replace(DateFormat, "99", "YY"
Michael几年前我发现了这个,我用它来检查地区日期格式:
Function DateFormat() As String
DateFormat = CStr(DateSerial(1999, 1, 2))
DateFormat = Replace(DateFormat, "1999", "YYYY")
DateFormat = Replace(DateFormat, "99", "YY")
DateFormat = Replace(DateFormat, "01", "MM")
DateFormat = Replace(DateFormat, "1", "M")
DateFormat = Replace(DateFormat, "02", "dd")
DateFormat = Replace(DateFormat, "2", "d")
DateFormat = Replace(DateFormat, MonthName(1), "MMMM")
DateFormat = Replace(DateFormat, MonthName(1, True), "MMM")
End Function
因此,在我的设置中,函数返回:dd/MM/YYYY您可以在
表示长日期,例如sLongDate
dddddd,d。年月日
表示短日期,例如sShortDate
yyyy-MM-dd
HKEY_CURRENT_USER\Control Panel\Internationaly\