在Crystal Report DateTime字段中仅提取年份值 [英] Extracting Only Year Value in Crystal Report DateTime Field

查看:69
本文介绍了在Crystal Report DateTime字段中仅提取年份值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Crystal Report,现在我处于一个情景中,我只需要从datetiem字段中提取Year值,例如,如果值为: 2014年1月3日10:20:01

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

我只需要提取 2014

我做了什么,我将字段的DataFormat更改为dd/mm/yyyyy

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)

显示 01AM

请帮助我

推荐答案

在这里,我已经采用这种方式,我的字符串是"2012年1月2日10:45:22Am"

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

使用此公式后:

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

我有这个值: 2012

这篇关于在Crystal Report DateTime字段中仅提取年份值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆