Search code examples
stimulsoft

Change date format from database


I'm using Stimulsoft Reports.Ultimate 2016.1. My date format from the database is dd-mm-yyyy. Is there any way that I can change the format into dd/mm/yyyy and display it like that?


Solution

  • You can achieve it by following query. Replace dbDate and table_name with yours.

    If dbDate is in varchar format you need to convert it first to datetime and then you can apply the below query.

    select convert(NVARCHAR,convert(datetime,<dbDate>),101) from <table_name>
    

    If dbDate is already in datetime format then you can simply apply below query to format date into dd/mm/yyyy

    select convert(NVARCHAR,<dbDate>,101) from <table_name>
    

    If you have any suggestions or doubt let me know.