DatePart


——————————————————————————————————————————————————
Support machine translation: http://amzn.to/1Z7d5oc
——————————————————————————————————————————————————

Crystal Reports Online Help
DatePart
Basic and Crystal syntax.
Overloads
DatePart (intervalType, inputDateTime)
DatePart (intervalType, inputDateTime, firstDayOfWeek)
DatePart (intervalType, inputDateTime, firstDayOfWeek, firstWeekOfYear)
Arguments
intervalType a String expression that specifies the part of a date to be returned. Possible values can be:
Interval type value Description
yyyy Extracts the year
q Quarter (the result is 1, 2, 3 or 4)
m Month (the result is from 1 to 12)
y Day of year (1 to 365 or 366 in a leap year)
d Day part of the date (1 to 31)
w Day of week (1 to 7 with the result depending on firstDayOfWeek)
ww Week of year (1 to 53 with firstDayOfWeek and firstWeekOfYear determining the exact days of the first calendar week of the year)
h Extracts the hour part of the given DateTime (0 to 23)
n Minute part (0 to 59)
s Second part (0 to 59)

inputDateTime is the DateTime value whose part will be extracted.
firstDayOfWeek is an optional constant used to specify the first day of the week. If not specified, crSunday is assumed. See Day of Week constants for more information.
firstWeekOfYear is an optional constant specifying the first week of the year. If not specified, the first week is assumed to be the one in which Jan. 1 occurs (crFirstJan1). See First Week of Year constants .
Returns
A Number value.
Action
DatePart returns a Number that specifies a given part of a given date.
Examples
The following examples are applicable to both Basic and Crystal syntax:
DatePart (“”d””, #August 15, 1999#)Returns 15.
DatePart (“”m””, #August 15, 1999#)Returns 8.
DatePart (“”n””, #10:35 am#)Returns 35.
DatePart (“”q””, #September 29, 1999#)Returns 3 since September 29 is in the third quarter of the year.
DatePart (“”ww””, #September 14, 1997#)Returns 38 since September 14, 1997 is in the 38th week of 1997.
Suppose that a company wants to stamp an id number on each of its shipments for quality control purposes. The id is composed of the order id, followed by a dash, followed by the week the order was shipped, followed by the last two digits of the year. Here is an example formula that produces these ids:
Rem Basic syntax
formula = CStr({Orders.Order ID}, 0, “”””) & “”-“” & _
CStr(DatePart(“”ww””, {Orders.Ship Date}), 0) & _
CStr({Orders.Ship Date}, “”yy””)

//Crystal syntax
CStr({Orders.Order ID}, 0, “”””) & “”-“” &
CStr(DatePart(“”ww””, {Orders.Ship Date}), 0) &
CStr({Orders.Ship Date}, “”yy””)Returns the string “”2082-3897″” if {Orders.Order ID} is 2082 and {Orders.Ship Date} is September 14, 1997.
Comments
This function is designed to work like the Visual Basic function of the same name.
The DatePart function with “”yyyy”” intervalType argument is the same as the Year function. Similarly, the DatePart function with “”m””, “”d””, “”w””, “”h””, “”n”” and “”s”” intervalType argument is the same as the functions Month, Day, Weekday (or DayOfWeek), Hour, Minute and Second respectively. On the other hand, there is no easy alternative to using the DatePart function for the “”q””, “”y”” and “”ww”” intervalType arguments.
The firstDayOfWeek argument affects the DatePart function when the interval type argument is “”w”” or “”ww””. For all other intervalType argument values, it is ignored.
The firstWeekOfYear argument affects the DatePart function only when the intervalType argument is “”ww””. For all other intervalType argument values, it is ignored.
——————————————————————————–

Previous page Next page
SAP BusinessObjects
http://www.sap.com/sapbusinessobjects/
Support services
http://service.sap.com/bosap-support/
Product Documentation on the Web
http://help.sap.com/



————————————————– ————————————————– ————————————————–
Appoġġ ta ‘traduzzjoni awtomatika: http://amzn.to/1Z7d5oc
————————————————– ————————————————– ————————————————–

Rapporti Crystal Online Għajnuna
DatePart
Bażiku u Crystal sintassi.
kariki żejda
DatePart (intervalType, inputDateTime)
DatePart (intervalType, inputDateTime, firstDayOfWeek)
DatePart (intervalType, inputDateTime, firstDayOfWeek, firstWeekOfYear)
argumenti
intervalType espressjoni String li tispeċifika l-parti ta ‘data li għandha tiġi rritornata. Valuri possibbli jista ‘jkun:
valur tip Intervall Deskrizzjoni
ssss Estratti il sena
Kwartier Q (ir-riżultat huwa 1, 2, 3 jew 4)
m Xahar (ir-riżultat huwa 1-12)
y Jum ta ‘sena (1-365 jew 366 fis-sena biżestili)
parti d Jum tad-data (1 sa 31)
Jum w ta ‘ġimgħa (1-7 bir-riżultat jiddependi fuq firstDayOfWeek)
ww Ġimgħa tas-sena (1 sa 53 u l firstDayOfWeek u firstWeekOfYear jiddetermina l-ġranet eżatti tal-ewwel ġimgħa kalendarja tas-sena)
h Estratti il-parti siegħa tal-DateTime mogħtija (0-23)
parti n Minuta (0-59)
i it-tieni parti (0-59)

inputDateTime huwa l-valur DateTime li parti tiġi estratta.
firstDayOfWeek huwa kostanti fakultattiv użati sabiex jiġu ddefiniti l-ewwel jum tal-ġimgħa. Jekk ma jkunx speċifikat, crSunday huwa preżunt. Ara Jum tal-kostanti Ġimgħa għal aktar informazzjoni.
firstWeekOfYear huwa kostanti fakultattiva jispeċifika l-ewwel ġimgħa tas-sena. Jekk ma jkunx speċifikat, l-ewwel ġimgħa huwa preżunt li jkun il-wieħed li fih iseħħ Jannar 1 (crFirstJan1). Ara ewwel ġimgħa ta ‘kostanti Sena.
denunzji
Valur Numru.
azzjoni
DatePart prospetti Numru li tispeċifika parti partikolari ta f’data partikolari.
eżempji
L-eżempji li ġejjin huma applikabbli kemm sintassi Bażiku u Crystal:
DatePart ( “”d””, #August 15, 1999 #) Denunzji 15.
DatePart ( “”m””, #August 15, 1999 #) Denunzji 8.
DatePart ( “”n””, # 10: 35 am #) Denunzji 35.
DatePart ( “”Q””, #September 29, 1999 #) Denunzji 3 minn Settembru 29 fit-tielet kwart tas-sena.
DatePart ( “”ww””, #September 14, 1997 #) Denunzji 38 sa minn Settembru 14, 1997 hija fil-ġimgħa 38 tal-1997.
Ejja ngħidu li kumpannija trid tittimbra numru ta ‘identifikazzjoni fuq kull wieħed mill-merkanija għal skopijiet ta’ kontroll tal-kwalità. Il-id hija komposta mill-ordni id, segwit b’sing, segwiti mill-ġimgħa d-digriet kien trasportat, segwita mill-aħħar żewġ ċifri tas-sena. Hawnhekk huwa formula eżempju li tipproduċi dawn l-ids:
Rem sintassi bażika
formula = CSTR ({Orders.Order ID}, 0, “”””) u “”-“” & _
CSTR (DatePart ( “”ww””, {Orders.Ship Data}), 0) & _
CSTR ({Orders.Ship Data}, “”yy””)

// Sintassi Crystal
CSTR ({Orders.Order ID}, 0, “”””) u “”-“” &
CSTR (DatePart ( “”ww””, {Orders.Ship Data}), 0) &
CSTR ({Orders.Ship Data}, “”yy””) Denunzji il-sekwenza “”2082-3897″” jekk {Orders.Order ID} huwa 2082 u {Orders.Ship Data} huwa 14 Settembru, 1997.
kummenti
Din il-funzjoni huwa maħsub biex jaħdem bħall-funzjoni Visual Basic ta ‘l-istess isem.
Il-funzjoni DatePart mal-argument “”ssss”” intervalType huwa l-istess bħall-funzjoni Sena. Bl-istess mod, il-funzjoni DatePart bi “”m””, “”d””, “”w””, “”h””, “”n”” u “”i”” l-argument intervalType huwa l-istess bħall-funzjonijiet Xahar, Jum, weekday (jew DayOfWeek), Hour, Minuta u t-Tieni rispettivament. Min-naħa l-oħra, m’hemm l-ebda alternattiva faċli biex tuża l-funzjoni DatePart għall- “”Q””, “”y”” u “”WW”” argumenti intervalType.
L-argument firstDayOfWeek taffettwa l-funzjoni DatePart meta l-argument tip intervall huwa “”w”” jew “”ww””. Għal kull valuri l-oħra argument intervalType, huwa injorat.
L-argument firstWeekOfYear taffettwa l-funzjoni DatePart biss meta l-argument intervalType huwa “”ww””. Għal kull valuri l-oħra argument intervalType, huwa injorat.
————————————————– ——————————