Results 1 to 4 of 4

Thread: Very simple SQL statement

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Location
    Limassol, Cyprus
    Posts
    125

    Very simple SQL statement

    Hi guys,

    I have this select statement
    "select date from dimtime"

    I would like to display the date into format dd-mm-yyyy
    How i can do that.
    ( I know that is too simple but in oracle database was select to_char(vdate,'dd-mm-yyyy') from dimtime. I do not know in sql)
    Best Regards
    avgoustinosc

  2. #2
    Hyperactive Member Bananafish's Avatar
    Join Date
    Jan 2001
    Posts
    394

    Re: Very simple SQL statement

    VB Code:
    1. CONVERT(char(10), @MyDateTime, 105)

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Very simple SQL statement

    A date is a date is a date. You use SQL code to retrieve date values from your database. Date values have no format. They just are. It is only when you want to display a date that it has to be converted to a string and then format becomes an issue. So, what I'm saying is just use your SQL to get your dates from Oracle without any thought of format. When you want to display them in a control on a form, then you need to think about format and it depends what control they're being displayed in as to how to go about it.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Location
    Limassol, Cyprus
    Posts
    125

    Re: Very simple SQL statement

    Thanks bananafish.
    Best Regards
    avgoustinosc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width