Baanboard.com

Baanboard.com (http://www.baanboard.com/baanboard/index.php)
-   Deutsches Forum (http://www.baanboard.com/baanboard/forumdisplay.php?f=65)
-   -   Kalenderwoche (http://www.baanboard.com/baanboard/showthread.php?t=69780)

MS-Tech 20th February 2017 16:10

Kalenderwoche
 
Hallo Zusammen,

gibt es in LN eine Funktion, mit der ich mir die aktuelle Kalenderwoche eines Datums ermitteln kann? Ich möchte z.B. einen Report erstellen, bei dem ich dann von Woche / bis Woche filtern kann?

Grüße
MS-Tech

vahdani 21st February 2017 14:03

Hallo,

es gibt die Funktion utc_to_week() für normale (UTC) Daten. Für ein Datum in Baan4 oder Fibu-Format gibt es dagegen num_to_week().

bdittmar 21st February 2017 15:38

utc.to.week()/num.to.week()/sprintf$()
 
Hallo,
hier einige Hinweise:
Code:

utc.to.week()
Syntax:

function long utc.to.week  (long utc, ref long week_dayno, ref long year_dayno, ref long weekno, ref long hours, ref long minutes, ref long seconds [, ref long yearno])

Description


This converts a UTC long format value to the corresponding day of the week, day of the year, week of the year, and so on, in local time.


Arguments

long utc The UTC long format value.
 
ref long week_dayno The day of the week. This depends on which day is defined as the first day of the week in the user data settings in the data dictionary.
 
ref long year_dayno The day number in the year.
 
ref long weekno The week number in the year. See Week handling.
 
ref long hours The time of day.
 
ref long minutes 
ref long seconds 
[ref long yearno ] The year number. This argument is optional.
 
 
Return values

0 Success.
-1 Error.
 
Context

This function can be used in all script types.

Notes
If the day of the week lies in the week that includes the turn of the year, weekno returns either 53, 0, or 1. The rules applied are:

Yearno argument included
If less that 4 days of the week belong to the old year, weekno returns 1 and yearno returns the number of the new year.
If 4 or more days belong to the old year, weekno returns 53 and yearno returns the number of the old year.
Yearno argument not included
If the day belongs to the old year, weekno returns 53.
If the day belongs to the new year and there are less that 4 days of the new year in the week, weekno returns 0.
If the day belongs to the new year and there are more that 3 days of the new year in the week, weekno returns 1.
Related topics

Dates, times, time zones synopsis
Dates,times, time zones overview
--------------------------------------------------------------------------------------------------------
num.to.week()
Syntax:

function long num.to.week  (long dayno, ref long week_dayno, ref long year_dayno, ref long weekno [, ref long yearno])

Description


This converts a specified number of days since 01-01-0001 to the corresponding day of the week, day of the year, and week number of the year.


Arguments

long dayno A number of days since 01-01-0001.
 
ref long week_dayno The day of the week. This depends on which day is defined as the first day of the week in the user data settings in the data dictionary.
 
ref long year_dayno The day number in the year.
 
ref long weekno The week number in the year. See Week handling.
 
[ref long yearno ] The year number. This argument is optional.
 
 
Return values

0 Success.
-1 Error.
 
Context

This function can be used in all script types.

Notes
If the day of the week lies in the week that includes the turn of the year, weekno returns either 53, 0, or 1.  The rules applied are:

Yearno argument included
If less that 4 days of the week belong to the old year, weekno returns 1 and yearno returns the number of the new year.
If 4 or more days belong to the old year, weekno returns 53 and yearno returns the number of the old year.
Yearno argument not included
If the day belongs to the old year, weekno returns 53.
If the day belongs to the new year and there are less that 4 days of the new year in the week, weekno returns 0.
If the day belongs to the new year and there are more that 3 days of the new year in the week, weekno returns 1.
Related topics

Dates, times, time zones synopsis
Dates,times, time zones overview
----------------------------------------------------------------------------------------------------
Nur Darstellung :

sprintf$()

%D xxx [ ,lang ] Use for dates.

xxx is the code for a date format defined in the data dictionary. lang indicates the language code to use. If this is omitted, the current user language is used.

The expression that is substituted for this symbol must specify a number of days since 01-01-0001.

Note that it isn't possible to use a comma direct after a %D xxx substitution symbol other than for selecting a language. As a workaround select a space as the language code, this will substitute the users default language and close the type element. Now it is possible to use the comma that should be included in your string. See the example in the example section.
 
%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’)
 
You can combine these subformats with other formats. Note that strings returned by name of month and day formats are language dependent.
 
%u xxx [ ,lang ] Use for UTC dates. xxx is the code for a UTC date format defined in the data dictionary. lang indicates the language code to use. If this is omitted, the current user language is used.
Note that it isn't possible to use a comma direct after a %u xxx substitution symbol other than for selecting a language. As a workaround select a space as the language code, this will substitute the users default language and close the type element. Now it is possible to use the comma that should be included in your string. See the example in the example section.
 
%U xxx [ ,lang ] Use for UTC times. xxx is the code for a UTC time format defined in the data dictionary. lang indicates the language code to use. If this is omitted, the current user language is used.
Note that it isn't possible to use a comma direct after a %U xxx substitution symbol other than for selecting a language. As a workaround select a space as the language code, this will substitute the users default language and close the type element. Now it is possible to use the comma that should be included in your string. See the example in the example section.
 
%u( format ) Use for UTC dates.

This option enables you to define your own date format by using the subformats described for the ‘ %D( format )’ symbol. You can combine these subformats with other formats.

Note that strings returned by name of month and day formats are language dependent.
 
%U( format ) Use for UTC times.

This option enables you to define your own time using the following subformats of the ‘%U’ format.

%H hours in 24 hour format
%h hours in 12 hour format
%m minutes
%s seconds
%a substitutes the am/pm symbol as defined for the user language
%x time separator as specified for the user language

Gruss

MS-Tech 23rd February 2017 18:24

Danke für eure Hinweise. Ich werde das gleich mal testen :).

Grüße
MS-Tech


All times are GMT +2. The time now is 00:39.


vB.Sponsors
©2001-2017 - Baanboard.com - Baanforums.com