2016-06-08 89 views

回答

1

使用內置weekday()功能:

>> [num, name] = weekday('08-Jun-2016') 
num = 
    4 
name = 
Wed 
>> [num, name] = weekday('29-Nov-2016') 
num = 
    3 
name = 
Tue 
1

除了weekday樂趣ction,您可以使用DDDDDDD格式在datestr功能,像這樣:

datestr('08-Jun-2016','DDD') %Returns the string 'Wed' 
datestr('08-Jun-2016','DDDD') %Returns the string 'Wednesday' 

或者,用一種更實用的格式

datestr('08-Jun-2016','DDDD, mmmm DD, yyyy') 
% Returns the string: 'Wednesday, June 08, 2016' 
相關問題