Reporting Services

Here I will try to concentrate useful tips and tricks for Reporting Services

For example, if dateEx = "2010-18-05" then:
Format(CDate(dateEx), "dd/MM/yyyy")

================================================================

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 
short date and long time 
M or m month and day 
Y or y year and month 
short time 
T long time 
s displays in ISO 8601 format using local time 
u displays in ISO 8601 format using universal time 
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 
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) 
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) 
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) 
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) 
seconds (1 or 2 digits as required) 
ss seconds 
first character in the am/pm designator 
tt am/pm designator 
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



First Day of current Year
=DateSerial(Year(Now()),01,01)

Last Day of current Year
=DateSerial(Year(Now()),12,31)


First Day of current Month
=DateAdd("d",1-DatePart("d",Today()),Today())

Last Day of current Month
=DATEADD("d",-1,DATEADD("m",1,DATEADD("d",1-DATEPART("d",Today()),Today())))


LiveJournal: igor_it