
I'm trying to create serial number who combine:
1) Last two digits in year: Year 2013 should be generated as 13.
2) Two digit for week number regarding to current date of creation: 20th - 26th of January 2014 is 04 (week 4 of the year).
3) Six digits start from 000001
My question is: How can I generate the year and week number? These numbers are always combined with "Today" so you don't have the option to manual set dates.
*This post is locked for comments
I have the same question (0)Use the DatePart function to extract the year and another call to extract the week and then combine with your serial number.
Syntax
DatePart(interval, date[,firstdayofweek[, firstweekofyear]])
The DatePart function syntax has these named arguments:
Part
Description
interval
Required. String expression that is the interval of time you want to return.
date
Required. Variant (Date) value that you want to evaluate.
firstdayofweek
Optional. A constant that specifies the first day of the week. If not specified, Sunday is assumed.
firstweekofyear
Optional. A constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs.
Settings
The interval argument has these settings:
Setting
Description
yyyy
Year
q
Quarter
m
Month
y
Day of year
d
Day
w
Weekday
ww
Week
h
Hour
n
Minute
s
Second