Last post Sep 20, 2014 12:42 AM by SDLion
Sep 11, 2014 03:44 AM|SDLion|LINK
I got very annoying problem. I'm trying to format time in RDLC. In the DataSet, the field is System.TimeSpan type. When I put it in my report, I get (as expected) time that looks like HH:mm:ss. I want to change it to HH.mm. I'm using formatting for that.
Here's what I get:
Any ideas why do I get #Error and how to set time format to HH.mm?
Sep 11, 2014 10:13 PM|Michelle Ge - MSFT|LINK
So far as I know, if you want to format the DataTime, please refer to the code below:
= FORMAT(Globals!ExecutionTime, "hh:mm")
Also, you can convert the DateTime to String, please refer to the code below:
printableString = dateValue.ToString("hh:mm");
Hope it's useful for you.
Sep 12, 2014 04:07 AM|SDLion|LINK
Thanks for your response.
I tried adding
= FORMAT(Fields!start_time.Value, "hh.mm")
but with no luck. Still getting #Error. And my data type is TimeSpan.
Sep 20, 2014 12:42 AM|SDLion|LINK
After trying numerous of things I found a solution.
First, I needed to use 'hh' instead of 'HH' to show hours.
Second, I cannot use simple symbols ':' or '.'. I need to use '\:' or '\.'.
So, to get the string I wanted (HH.mm), I need to use format hh\.mm.