Dbeaver / Date Format

Background

Quick follow-up to our last post on String Representation of datetime.

Referenced Post

BTW, that post is here:

Db/2 – LUW – SQL Error [22007]: “The string representation of a datetime value is out of range”
Link

Goal

In this post we will discuss options for displaying date columns in “locale” sensitive ways.

Implementation

Dbeaver

Query

SQL Server

When we issue a query that looks like the one below :-

Sample

select
          tblSD.name as [name]
        , tblSD.create_date as [createTS]
        , cast(tblSD.create_date as date) as [createDate]

from   sys.databases tblSD

Output

sys.databases.20180926.0714AM

Explanation
  1. Columns
    • createDate
      • Values
        • 2003-04-08
      • Representation
        • YYYY-MM-DD
        • ISO

Dbeaver Configuration

Objective

Let us configure our JDBC Connection

Steps

  1. From the left panel, choose Data Source
  2. Right click on Data Source
  3. Select Properties
  4. In Properties Window
  5. In the left window, select “Result Sets” \ “Data Formats”
  6. In the Data Formats window
    • Tick the checkbox to grant us the opportunity to modify
    • Customize per your needs
      • Locale
        1. Language :- en-English
        2. Country :- US – United States
        3. Locale :- en_US
      • Format
        1. Type :- Date
        2. Pattern :- MMM-dd-yyyy

Data Formats

Data Formats – Date
Original

DateFormats.20180926.0720AM.PNG

Revised

DateFormats.20180926.0724AM

Data Formats – Other

Please keep in mind we are able to customize other data types, as well.

Inclusive are Date time types  ( Date, Time, Timestamp ) and Numbers.

DateFormats.OtherOptions.20180926.0828AM.PNG

Query

SQL Server

If we go back and re-issue our query, here is what it will look like:

Output

sys.databases.20180926.0726AM

Explanation

Our dates now look like Month-Day-Year.

References

  1. Dbeaver
    • dbeaver/dbeaver
      • Dates from DB2 on IBM i are displayed as “null” #2948
        Opened By / On Date :- savadgecayet commented on Feb 8
        Link

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s