且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

excel vba-如何获取日期的日期名称?

更新时间:2023-01-31 16:14:18

对于您的特定请求,假设您的日期字符串的格式设置为您的区域设置:

For your specific request, assuming your date string is formatted as your regional setings:

    sDayName = Format("11/01/2016", "dddd")

如果您要今天的工作日:

If you want the weekday for today:

    sDayName = Format(Date, "dddd")

如果您希望在任何日期使用工作日任何区域设置

If you want the weekday for any date in any regional settings

    sDayName = Format(DateSerial(2016, 11, 4), "dddd")
    'change 2016, 11, 4 for your year, month, day values

:)