format date within reporting services

  • ryan121 (9/22/2009)


    has anyone made a 'cheat sheet' for formatting in SSRS? ...

    Like this perhaps?: http://john-sheehan.com/blog/wp-content/uploads/msnet-formatting-strings.pdf

  • Ryan,

    Would not work,

    cause "mm" stands for minutes, not Months

    if you have the need for the day first :

    go to the filed expression

    type : =format(fields!fieldname.value,"dd/MM/yyyy") , gives 19/11/2009

    =format(fields!fieldname.value,"MM/dd/YYYY"), gives 11/19/2009

    =format(fields!fieldname.value,"yyyy/dd/MM"), gives 2009/19/11

    you can also change the / by - or : of whatever separator you want to use

    Hopes this helps you a bit.

    Wkr,

    Eddy

  • Use =FormatDateTime(Data Field Name,2) or =Format(Data Field Name,"mm/DD/yyyy").

  • dssingh17-819020 (2/3/2010)


    Use =FormatDateTime(Data Field Name,2) or =Format(Data Field Name,"mm/DD/yyyy").

    No, impossible, cause lowercase 'mm' will give you minutes in stead of months

    its just the mm that would have to be in uppercase and the dd have to be in lowercase

    =format(datetimefield.value,"MM/dd/yyyy") = 11/20/2010

    or in european format

    =format(datetimefield.value,"dd/MM/yyyy") = 20/11/2010

    wkr,

    Eddy

  • 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.

  • 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")

  • i need to print date like October 14, 2010

  • Which version of SSRS? 2000, 2005, or 2008?

    Brandie Tarvin, MCITP Database AdministratorLiveJournal Blog: http://brandietarvin.livejournal.com/[/url]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.

  • 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 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/%5B/quote%5D

    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/[/url]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.

  • 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.

  • 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/[/url]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.

  • This is what worked for us. Use =User!Language under the Language Property for the report.

  • 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

Viewing 15 posts - 16 through 30 (of 45 total)

You must be logged in to reply to this topic. Login to reply