Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting Only Year Value in Crystal Report DateTime Field

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

I only need to extract 2014

I did what is that , I changed the DataFormat of the field is dd/mm/yyyyy

Now i hav eapplied formula on it.

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

It shows 01AM

Kindly help me out

like image 888
DareDevil Avatar asked Mar 14 '14 09:03

DareDevil


1 Answers

Here I have done with this way, my string was "01/02/2012 10:45:22Am"

after using this formula:

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

I have got this value :2012

like image 159
DareDevil Avatar answered Dec 06 '22 13:12

DareDevil