Retrieving only year value in Crystal Report DateTime field

I work with Crystal Report, now I am in a place where I need to extract only the Year value from the datetiem field, for example, if the value is: 01/03/2014 10:20:01 AM

I only need to extract 2014

I did what I changed the DataFormat of this field: dd / mm / yyyyy

Now I use the formula on it.

Formula = Right(CStr ({report;1.FirstYearDate}),4)

He shows 01AM

Please help me

+6
source share
4 answers

Here I did so, my line was "02/01/2012 10: 45: 22Am"

after using this formula:

Formula = ToText({report_;1.FirstYearDate}, "yyyy")

I have this value: 2012

+7

Year(Cdatetime(<<your date time value here>>));
+4

Year (DateValue ({Orders.Order Date}))

, , Order date Orders.

+2

. - {Orders.POST_DATE} minimum(YearToDate) maximum(LastFullMonth).

This worked fine until it was launched in the new year. Then Crystal read the dates as the last day of the last month and the first day of the new year.

Seeing the solution here. I changed my code in a way that works:

{Orders.POST_DATE}in DateSerial(Year (minimum(LastFullMonth)), 1,1)to maximum(LastFullMonth)which now makes maximum(LastFullMonth)/ yyyy the same as the year in LastFullMonth.

+1
source

Source: https://habr.com/ru/post/1531728/


All Articles