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.
Use the DatePart function to extract the year and another call to extract the week and then combine with your serial number.
DatePart(interval, date[,firstdayofweek[, firstweekofyear]])
The DatePart function syntax has these named arguments:
Required. String expression that is the interval of time you want to return.
Required. Variant (Date) value that you want to evaluate.
Optional. A constant that specifies the first day of the week. If not specified, Sunday is assumed.
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.
The interval argument has these settings:
Day of year
Other Microsoft Sites
I'm a Customer
I'm a Partner
Follow Microsoft Dynamics