简体   繁体   English

如何从自定义日期字符串中获取周数

[英]How to get week number from custom date string

I have this type of strings 我有这种类型的字符串

DECW42012
JANW12013
JANW22013
JANW32013
JANW42013
JANW52013
FEBW12013

Can i somehow get week number (not in month but in year) from that string ? 我可以以某种方式获得该字符串的周数(不是月份而是年份)吗? thank you 谢谢

=WEEKNUM(DATE(RIGHT(A1,4),MONTH(LEFT(A1,3)&1),1),2)+(MID(A1,5,1)-1)

应该做的伎俩。

You could start with the following, 你可以从以下开始,

=WEEKNUM(DATEVALUE(LEFT(A1,3)&RIGHT(A1,4))+(MID(A1,5,1)-1)*7)

WEEKNUM功能

The WEEKNUM function has an optional return_type parameter that I have not implemented and that is one that you should pay close attention to if you wish to get the correct returns for your week numbe schedule. WEEKNUM函数有一个我没有实现的可选return_type参数,如果你希望获得周数量表的正确回报,那么你应该密切注意这个参数。

Edited: dropped the week-of-month by 1 before multiplication 编辑:在乘法之前将周数减少1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM