Svidos29
3rd April 2018, 13:18
Hi all,
the question is: how can i calculate the number of the week, based on the day that i have ? For example 05/02/2018 ==> week 6.
thanks in advance.
mark_h
3rd April 2018, 14:36
I do not know about LN but in 4c4 I can look at the company calendar (tirou400) to get the week.
bdittmar
3rd April 2018, 14:58
Hello,
do a search before post, please. It's discussed several time.
Use sprintf$()
%D( format ) Use for dates.
This option enables you to define your own date format by using the following subformats of the ‘%D’ format:
%m month in year 1 - 12
%w week in year week 0 in previous year week 53 in current year
%W week in year week 53 in previous year
%d day in month 1 - 31
%e day in week 1 - 7
%j day in year 1 - 365
%y year without century 01 - 99
%Y year with century 1 - 9999
%h name of month (‘Jan’ - ‘Dec’)
(abbreviated)
%H name of month (‘January’ - ‘December’)
%a name of day (‘Sun’ - ‘Sat’)
(abbreviated)
%A name of day (‘Sunday’ - ‘Saturday’)
Example:
Dates
| Suppose date format 002 is: "year/month/day in month"
string result(80)
result = sprintf$("%D002", 727168)
| result contains "1991/12/2"
| Example of substitution symbol %D(format)
string result(80)
result = sprintf$("%D(Date: %02d/%02m/%04Y)", date.num())
| result contains "Date: 12/07/1993"
result = sprintf$("Date: %D(%02d %-20H %04Y)", date.num())
| result contains "Date: 12 June 1993"
UTC dates and times
| Date format 002 is "year/month/day in month"
| Time format 001 is "12 hour format:minutes:seconds AM/PM symbol"
string result(80)
result = sprintf$(" %001", utc.num(), utc.num())
| Result contains "1997/01/01 10:02:53 pm"
string result(80)
result = sprintf$("UTC: %u(%02d/%02m/%04Y) %U(%02h%x%02m%x%025 %a)", utc.num(), utc.num())
| result contains "UTC: 22/07/1997 06:24:53 am"
| provided that for the user's language the time
| separator is ":" and the AM symbol is "am"
| Using a comma after a %u substitution symbol
string result(80)
result = sprintf$(", ,Message text....", utc.now())
| result containts "06-05-15,Message text...."
Regards
vahdani
3rd April 2018, 16:46
Hi Svidos29,
you depending on your type of date (UTC or days since 01.01.01) you can use either num.to.week() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_date_time_zones_num_to_week) or utc.to.week() (http://www.baanboard.com/programmers_manual_baanerp_help_functions_date_time_zones_utc_to_week) function!
v_kewl
11th April 2018, 01:23
long o.wkdy, o.yrdy, o.week, o.year
num.to.week(date.num(), o.wkdy, o.yrdy, o.week, o.year)
o.week hold the value which you are looking