SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: Oracle, date

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Jul 2006
    Posts
    97
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Oracle, date

    Hello all,

    I've got an insert like:
    insert into tablename values ('1', '2', '3', to_date('2/2/2009','MM/DD/YYYY'));

    and then a select like:

    select to_char(datefield,'dd/mm/yyyy') as reg_day from "tablename";

    and getting a result of date like 02/02/2009 instead of 2/2/2009. Don't ask me why, I just need the result to be 2/2/2009 or ideally the initial insert to somehow store the data in 2/2/2009 format and not in 02/02/2009.

    Is there a way to insert a date field in d/m/yyyy instead of dd/mm/yyyy?

    Thanks

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,578
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Here's the manual page for to_char:
    http://www.techonthenet.com/oracle/f...ns/to_char.php

    Which has examples of how to mask the zeros.


Bookmarks

Posting Permissions

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