Waqas
Waqas

Reputation: 867

how to format date in crystal report as dd-mm-yy using formula field?

I use

ToText(Cdate({dt_vw_Rept_Attend.StartDate}),"dd-MMM-yyyy")

formula to formate datetime string in crystal report to display day-month-year but it doesn't work for me.

if i have datetime in my database as 7/28/2015 12:00:00 AM

so according to function it should be 28-Jul-2015

but i am getting this again 7/28/2015 12:00:00 AM

I need your help to resolve this. thanks in advance.

Upvotes: 0

Views: 15667

Answers (1)

Bhavin
Bhavin

Reputation: 789

Try below code.

ToText({dt_vw_Rept_Attend.StartDate}, "yyyyMM")           ==>    “201101″
ToText({dt_vw_Rept_Attend.StartDate}, "dd-MMM-yyyy")       ==>   “15-Jan-2011″
ToText({dt_vw_Rept_Attend.StartDate}, "dd MMM yyyy")       ==>  “15 Jan 2011″
ToText({dt_vw_Rept_Attend.StartDate}, "MM/dd/yy")           ==>  “01/15/11″
ToText({dt_vw_Rept_Attend.StartDate}, "dddd, MMM d, yyyy") ==>  “Saturday, Jan 1, 2011″
ToText(Cdate({dt_vw_Rept_Attend.StartDate}))

And for more information http://crystaltricks.com/wordpress/?p=149 Hope you solve

Upvotes: 1

Related Questions