在Crystal Reports中将字符串转换为日期 [英] Converting string to date in Crystal Reports

查看:64
本文介绍了在Crystal Reports中将字符串转换为日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Crystal Reports的新手,我试图从字符串中提取和显示月份和年份(在DB中,列的数据类型为varchar).以下是数据示例.

I'm new to Crystal Reports, I'm trying to extract and display month and year from the string (In DB the data type of the column is varchar). Following is an example of the data.

2012年1月5日上午11.49.28.000000000

05-JAN-12 11.49.28.000000000 AM

我需要以下格式的

1月12日

我使用了

I have used cDate to convert the string to date format but was unsuccessful, maybe I didn't do it right way.

推荐答案

更改公式以提取日期部分,然后将其转换为 date :

Alter the formula to extract the date portion, then convert it to a date:

DateValue(Split("05-JAN-12 11.49.28.000000000 AM")[1])

根据需要将格式应用于字段.

Apply formatting to the field as desired.

这篇关于在Crystal Reports中将字符串转换为日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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