SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


format date within reporting services


format date within reporting services

Author
Message
Seth Lynch
Seth Lynch
SSCrazy
SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)SSCrazy (2.6K reputation)

Group: General Forum Members
Points: 2627 Visits: 603
I use this for date parameters:


Select Right('0' + Cast(Day(dateRange) as Varchar(2)),2) +'/'+
Right('0' + Cast(Month(dateRange)as Varchar(2)),2) + '/'+
cast(Year(dateRange) as char(4)) as label,
dateRange as value



Then in Report Parameters Label shows up like 01/04/2010 (which is what the user sees), value is 04/01/2010 (I am in the UK so users want to see dd/mm/yyyy).

DateRange here is a smalldatetime value.
jadernet
jadernet
SSC Rookie
SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)SSC Rookie (49 reputation)

Group: General Forum Members
Points: 49 Visits: 1
If it is a string object, you need to convert to date first.
For example, if dateEx = "2010-18-05" then:
Format(CDate(dateEx), "dd/MM/yyyy")
khalidlatif
khalidlatif
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 Visits: 21
i need to print date like October 14, 2010
Brandie Tarvin
Brandie Tarvin
SSC Guru
SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)

Group: General Forum Members
Points: 146805 Visits: 9633
Which version of SSRS? 2000, 2005, or 2008?

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Ali Bajwa
Ali Bajwa
Old Hand
Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)

Group: General Forum Members
Points: 377 Visits: 134
It is pretty simple to set the date format in SSRS if you know how to. Please follow my blog to resolve your issue:
http://alibajwa.blogspot.com/
Brandie Tarvin
Brandie Tarvin
SSC Guru
SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)

Group: General Forum Members
Points: 146805 Visits: 9633
Ali Bajwa (11/5/2010)
It is pretty simple to set the date format in SSRS if you know how to. Please follow my blog to resolve your issue:
http://alibajwa.blogspot.com/


Ali, be careful about making comments like this, please. If you have a specific article on your blot, point him to the perma link, but don't say "follow my blog" like this or people will think you're a spam advertiser and you will get banned.

In regards to your first statement, saying "if you know how" is a bit rude. He posted on this forum because he didn't know how. In the future please either answer the question directly, ask for more details if you don't know which answer to give him, or point him to specifically helpful articles. This is proper forum ettiquette.

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
Ali Bajwa
Ali Bajwa
Old Hand
Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)Old Hand (377 reputation)

Group: General Forum Members
Points: 377 Visits: 134
Thanks Brandie for correcting me. I apologize if I have offended anyone in anyway, it was never meant to. Apologies again, all I wanted was to help. Cheers.
Brandie Tarvin
Brandie Tarvin
SSC Guru
SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)SSC Guru (146K reputation)

Group: General Forum Members
Points: 146805 Visits: 9633
You haven't offended. I just wanted to make sure you knew the proper behavior so you wouldn't have problems in the future.

On the other hand, the poster hasn't responded to my questions or your post, so I have no idea if he resolved his problem or not.

Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/On LinkedIn!, Google+, and Twitter.Freelance Writer: ShadowrunLatchkeys: Nevermore, Latchkeys: The Bootleg War, and Latchkeys: Roscoes in the Night are now available on Nook and Kindle.
gary_nilsen
gary_nilsen
SSC Rookie
SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)SSC Rookie (37 reputation)

Group: General Forum Members
Points: 37 Visits: 0
This is what worked for us. Use =User!Language under the Language Property for the report.
Edward Boyle-478467
Edward Boyle-478467
SSC Eights!
SSC Eights! (884 reputation)SSC Eights! (884 reputation)SSC Eights! (884 reputation)SSC Eights! (884 reputation)SSC Eights! (884 reputation)SSC Eights! (884 reputation)SSC Eights! (884 reputation)SSC Eights! (884 reputation)

Group: General Forum Members
Points: 884 Visits: 1225
The Format function is locale aware and can be used as follows [not the case senstivity]
Set Language=User!language in the Report properties and use the Format function with the following codes:
Standard Format Specifiers for Dates and Times:
The table below shows the standard date and time formatters.

Format Description Example
d Short Date
D Long date
f long date & short time
F long date and long time
g short date and short time
G short date and long time
M or m month and day
Y or y year and month
t short time
T long time
s displays in ISO 8601 format using local time
u displays in ISO 8601 format using universal time
U date and time in unversal time
R or r displays in RFC 1123 format

Custom formatting sequences:
There are also specific character sequences that can be used to achieve custom formatting of dates and times.

Format Description
d day of month (1 or 2 digits as required)
dd day of month (always 2 digits, with a leading 0 if needed)
ddd day of week (3 letter abbreviation)
dddd day of week (full name)
M month number (1 or 2 digits as required)
MM month number (always 2 digits, with a leading 0 if needed)
MMM month name (3 letter abbreviation)
MMMM month name (full name)
y year ( last 1 or 2 digits, no leading 0)
yy year (last 2 digits)
yyyy year (4 digits)
H hour in 24-hour format (1 or 2 digits as required)
HH hour in 24-hour format (always 2 digits, with a leading 0 if needed)
h hour in 12-hour format (1 or 2 digits as required)
hh hour in 12 hour format
m minutes (1 or 2 digits as required)
mm minutes (always 2 digits, with a leading 0 if needed)
s seconds (1 or 2 digits as required)
ss seconds
t first character in the am/pm designator
tt am/pm designator
z time zone offset, hour only (1 or 2 digits as required)
zz time zone offset, hour only (always 2 digits, with a leading 0 if needed)
zzz time zone offset, hour and minute
/ default date separator
: default time separator
\ escape characters
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum








































































































































































SQLServerCentral


Search