Help convert date please

I have 3 possible length Dates stored in a VARCHAR2 field type, I am trying to convert that for a friend:
we are looking for this in the End as either a Date or a Number field or both (that's what is needed)
20110829 YYYYMMDD
what I have is these distinct length type on the field:
8
07/13/13
9
6/30/2012
10
10/13/2011
Can someone help me convert this field to either number: 20120512 or Date YYYYMMDD ? both examples would help too :- ) learning

You can use the below to find the problem date(s) in your table. The SELECT obviously needs to be updated with your table/column names
CREATE OR REPLACE FUNCTION dateconvert(p_chardate  VARCHAR2)
RETURN VARCHAR2
AS
  v_date  DATE;
BEGIN
  v_date := TO_DATE(p_chardate, 'MM/DD/RR');
  RETURN 'OK';
EXCEPTION
  WHEN OTHERS THEN
    RETURN   p_chardate;
END;
SELECT datecol
FROM   datetable
WHERE dateconvert(datecol) != 'OK';

Similar Messages

  • Help convert date

    hi help convert date
    April 26, 1904....August 12, 1979
    to dd/mm/yyyy

    SELECT CONVERT(VARCHAR(15),CAST('April 26, 1904' AS DATE),103)
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • PHP need help formating date, please.

    I am working on my first database page using repeating fields
    and a
    connection to MySQL, and actually have it working! Yay!
    Now I have a formatting problem, and would appreciate a bit
    of help.
    The first column of the repeating field is a date field,
    which is stored
    as a date type in mysql, and shows up in my table as
    2008-03-12 (which
    is how it was entered into the table). I would like to change
    the
    display to March 12, 2008. I have tried using the date
    function, but
    without success. The text that php is putting in the cell is
    "2008-03-12", which I am guessing is not a valid timestamp. I
    am also
    guessing that this is why I get a date in 1969 when I try
    this...
    The page is here:
    http://www.verodelmar.com/agendas.php
    and the source is here:
    http://www.verodelmar.com/agendas.txt
    Thanks to anyone that takes the time to look!
    Harvey

    Joe Makowiec wrote:
    > On 16 Apr 2008 in macromedia.dreamweaver, eclipsme
    wrote:
    >
    >> The first column of the repeating field is a date
    field, which is
    >> stored as a date type in mysql, and shows up in my
    table as
    >> 2008-03-12 (which is how it was entered into the
    table). I would
    >> like to change the display to March 12, 2008. I have
    tried using the
    >> date function, but without success. The text that
    php is putting in
    >> the cell is "2008-03-12", which I am guessing is not
    a valid
    >> timestamp. I am also guessing that this is why I get
    a date in 1969
    >> when I try this...
    >
    > Use DATE_FORMAT in your SQL statement, thus:
    >
    > SELECT field1, field2,
    > DATE_FORMAT(dateField, '%M %e, %Y') AS myFormattedDate
    > FROM myTable
    >
    >
    http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_date-format
    >
    > Another option is to convert the date from ISO format to
    a Unix
    > timestamp using PHP's strtotime() function, then
    formatting it using
    > date():
    >
    > <?php
    > // Done in several steps for clarity. Can be done in one
    step.
    > $myUnixTimestamp =
    strtotime($row_Recordset1['mydatefield']);
    > $myFormattedDate = date('F j, Y', $myUnixTimestamp);
    > echo $myFormattedDate;
    > ?>
    >
    >
    http://www.php.net/strtotime
    >
    http://www.php.net/date
    >
    The former I think I understand.
    The latter I have printed out and will look at some more.
    Actually in
    theory I understand, but how to do that in my control panel
    is what I
    need to look at.
    Thanks!
    Harvey

  • Need help with dates  please-urgent

    Hi folks, please help me with this if you can.
    I run a weekly job, and need to have my java code create and use 2 dates to capture data for the whole week.
    begin_date mm/dd/yyyy (String) to be 7 days prior to current date
    end_date mm/dd/yyyy (String) to be the currecnt date
    Note: please take into account the cases where the CURRENT_DATE is the first week of the month. As a result the 7 days prior will fall into the previous month. i.e if end_date="06/04/2003" then the begin_date will be "05/29/2003 Thanks a bunch

    http://java.sun.com/j2se/1.4.1/docs/api/index.html
    See the Calendar and DateFormat classes.

  • I need help converting date interger in string.

    I am a beginner if you can even say that..... But to the point I'm using Dreamweaver and I'm pulling data from my database and it's being displayed on my webpage. Currently the code below pulls the month from the database as a number. I would like it to pull the date and change it from a number to it corresponding abbreviated month. ( ie. if it pulls 12-01-11 I need the 12 to be displayed as DEC on my website.) any help is much appreciated.
    <?php echo $row_frt_summary['month']; ?>

    You can do it either in SQL or PHP,
    For MySQL, use the date_format function with the %b specifier:  http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_date-format
    For PHP, use date_fomat with the M format character: http://www.php.net/manual/en/function.date-format.php
    Also, PHP, SQL and application development questions should be posted in the app dev forum.

  • My ipod touch is in DFU mode 5g I need help, do not want to lose my data, please help in Spanish

    I need help, do not want to lose my data, PLEASE HELP IN SPANISH

    Una vez que el dispositivo está pidiendo ser restaurado con iTunes ... ya es demasiado tarde para salvar nada ... y usted debe continuar con la recuperación de ...
    Vea aquí> http://support.apple.com/kb/HT1808
    Es posible que tenga que probar más de una vez ... Asegúrese de seguir todos los pasos ...
    Tómese su tiempo ... Preste especial atención a los pasos 3 y 4.
    Para minimizar la pérdida ...
    Después de haber recuperado su dispositivo ...
    Re-sincronizar su contenido o restauración de la última copia de seguridad ...
    Restaurar desde copia de seguridad> http://support.apple.com/kb/ht1766
    Once the Device is asking to be Restored with iTunes... it is too late to save anything... and you must continue with the Recovery...
    See Here  >  http://support.apple.com/kb/HT1808
    You may need to try this More than Once...  Be sure to Follow ALL the Steps...
    Take your time... Pay particular attention to Steps 3 and 4.
    To minimise loss...
    After you have Recovered your Device...
    Re-Sync your Content or Restore from the most recent Backup...
    Restore from Backup  >  http://support.apple.com/kb/ht1766

  • I was updating software and suddenly my IPHONE  started asking for I tunes on mobile screen ,  how can  i  get by screen back or How i can restore without loosing data , I m more worried about data , Please help in resolutio

    i was updating software and suddenly my IPHONE  started asking for I tunes on mobile screen ,  how can  i  get by screen back or How i can restore without loosing data , I m more worried about data , Please help in resolutio

    What exactly are you seeing on the phone's screen ? If the iTunes icon and cable then the phone is in recovery mode, in which case it's too late to take a new backup or to copy any content off the phone - you will have to connect the phone to your computer's iTunes and reset it back to factory defaults, after which you can restore to the last backup that you took or just resync your content to it

  • I am a macbook pro user form last 2 yrs, recently i upgraded to Mountain Lion from Snow leopard. Since then  operational  speed is a major concern. Now It has crashed so very badly that I am scared of my data.Please help me.

    I am a macbook pro user form last 2 yrs, recently i upgraded to Mountain Lion from Snow leopard. Since then  operational  speed is a major concern. Now It has crashed so very badly that I am scared of my data.Please help me.

    Reinstalling Lion/Mountain Lion Without Erasing the Drive
    Boot to the Recovery HD: Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Repair the Hard Drive and Permissions: Upon startup select Disk Utility from the main menu. Repair the Hard Drive and Permissions as follows.
    When the recovery menu appears select Disk Utility. After DU loads select your hard drive entry (mfgr.'s ID and drive size) from the the left side list.  In the DU status area you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is failing or failed. (SMART status is not reported on external Firewire or USB drives.) If the drive is "Verified" then select your OS X volume from the list on the left (sub-entry below the drive entry,) click on the First Aid tab, then click on the Repair Disk button. If DU reports any errors that have been fixed, then re-run Repair Disk until no errors are reported. If no errors are reported click on the Repair Permissions button. Wait until the operation completes, then quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion: Select Reinstall Lion/Mountain Lion and click on the Continue button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible because it is three times faster than wireless.

  • Need help in converting date format

    Hi,
    Need help in converting date format from 'DD-MON-YYYY' to 'YYYY-MM-DD' in an .rtf template as I believe xml publisher supports the date format as 'YYYY-MM-DD' only.
    Thanks,
    Raj.

    I got the same problem, anyone know how to solve this problem? I allready found some date functions on http://blogs.oracle.com/xmlpublisher/2008/09/date_functions.html . I also tried <?xdoxslt:month_name(xdoxslt:get_month(xdofx:substr(NEED_BY_DATE, 4,3)), $_XDOLOCALE), 0, 'nl-NL')?>, but then it returns a namespace error (Caused by: oracle.xdo.parser.v2.XPathException: Namespace prefix 'xdofx' used but not declared.). Anyone know how to fix this?
    Edited by: user11165753 on 7-dec-2009 23:50

  • Hi as iam changing the ical message allert date to daybefore automatically it is changing to on the date please help me, hi as iam changing the ical message allert date to daybefore automatically it is changing to on the date please help me

    hi,
    As iam changing the ical message allert date to "daybefore" automatically it is changing to "on the date"   
    please help me,

    You could simplify the decode(... into to_char(sysdate + 1,'d')
    select sysdate + level input_date,
           TRIM(TO_CHAR(SYSDATE + level,'DAY')) the_day,
           DECODE(TRIM(TO_CHAR(SYSDATE + level,'DAY')),
                  'SATURDAY',1,
                  'SUNDAY',2,
                  'MONDAY',3,
                  'TUESDAY',4,
                  'WEDNESDAY',5,
                  'THURSDAY',6,
                  'FRIDAY',7
                 ) daynumber,
           to_char(sysdate + level + 1,'d') alternative
      from dual
    INPUT_DATE
    THE_DAY
    DAYNUMBER
    ALTERNATIVE
    10/14/2013
    MONDAY
    3
    3
    10/15/2013
    TUESDAY
    4
    4
    10/16/2013
    WEDNESDAY
    5
    5
    10/17/2013
    THURSDAY
    6
    6
    10/18/2013
    FRIDAY
    7
    7
    10/19/2013
    SATURDAY
    1
    1
    10/20/2013
    SUNDAY
    2
    2
    10/21/2013
    MONDAY
    3
    3
    10/22/2013
    TUESDAY
    4
    4
    10/23/2013
    WEDNESDAY
    5
    5
    10/24/2013
    THURSDAY
    6
    6
    10/25/2013
    FRIDAY
    7
    7
    10/26/2013
    SATURDAY
    1
    1
    10/27/2013
    SUNDAY
    2
    2
    10/28/2013
    MONDAY
    3
    3
    Regards
    Etbin

  • I have iphone 5 ,i cut down bsnl 64k sim into nano and inserted it. everything is working except cellular data or 3g data, please help me

    i have iphone 5 ,i cut down bsnl 64k sim into nano and inserted it. everything is working calling & messaging except cellular data or 3g data, please help me

    Everything you need to know about the solution is written into the question you posed. Get a proper SIM.

  • Help convert LV5.1vi to 8.x please.

    Can someone help convert the vi at the link below to a contemporary version of LV?
    http://zone.ni.com/devzone/cda/epd/p/id/558
    I don't have anything old enough installed to open it. I don't even know what it is, but one of my users requested it.
    Thanks in advance!
    Chris
    Solved!
    Go to Solution.

    Here it is in 8.2, though once you see it, I think you will find it would be easier to just use Read From Spreadsheet File.
    Attachments:
    parse_lookup_table.vi ‏23 KB

  • My iPhone4s turned itself off and will not turn back on unless it is charge data all times. I need help and answers please.

    My iPhone4s turned itself off and will not turn back on unless it is charged at all times. I need help and answers please.

    And we would need more info. "will not turn back on unless it is charged at all times." is pretty obvious: the phone will obviously not turn on unless it is charged.
    Describe your problem clearly.

  • Please Help ----------in Date format

    Hi , friends,
    iam in very troubles in this problemb from this week
    i have some text fields , where i put dd/MM/yyyy format as a string , and
    then converting it as date saving in a hash table
    later when i want get back from hash table , iam fromatting ]
    by using
        DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
    Date newDate =(Date) (list.get(j));
      String dateString =df.format(newDate);where list is a arraylist
    but how to get dd/MM/yyyy format

    Thanks for your reply
    but
    i have another problemb relating to this
    actuallly i am perparing holiday list
    where i put date and details as a string in two text field and save in a file in appending
    later i convert date String as a date object and putiing in a hash table as a key and value later
    i put keys in a array list (list)and sorting it by Collections.sort(list) method
    and now after sorting i put the sorted date and details in another file,
    and deleting the old file and renaming the file as a old file,
    File f1 = new File("d:/bea/wlserver6.1/date1.txt");
                  FileReader fr = new FileReader(f1);
                    File f2 = new File("d:/bea/wlserver6.1/date3.txt");
                    boolean flag;
                    flag = f2.createNewFile();
    boolean flag1;
                         boolean flag2;
                     flag1 =f1.delete();
                         flag2 = f2.renameTo(f1);
                     System.out.println(flag1);
                     System.out.println(flag2);but still error is coming like fileNotFoundException

  • Need to convert  Date from calendar to String in the format dd-mom-yyyy

    Need to convert Date from calendar to String in the format dd-mom-yyyy+..
    This is absolutely necessary... any help plz..
    Rgds
    Arwinder

    Look up the SimpleDateFormat class: http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
    Arwinder wrote:
    This is absolutely necessary... any help plz..For you maybe, not others. Please refrain from trying to urge others to answer your queries. They'll do it at their own pace ( if at all ).
    People on the forum help others voluntarily, it's not their job.
    Help them help you.
    Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
    (Yes I know it's on JavaRanch but I think it applies everywhere)
    ----------------------------------------------------------------

Maybe you are looking for

  • Upgrading the HD in a 700MHz iMac G4 Flat Panel

    I want to upgrade my iMac to a bigger HD. I was told these older iMacs can only read up to 160GB hard drive and it needs to be an IDE drive? Is this true? What's the largest capacity I can go on an older iMac such as mine? Thanks.

  • MacBook and MAcBook Pro with ProTools

    I have both a MAcBook and and a MAcBook Pro and ProTools runs fine on the Pro, however on the MAcBook ( 2 gig dual with 1 gig ram) the USB bus does not seem to have the power to drive the PRoTools MBOX 2 interface. ANy info on that? I'm surprised tha

  • Problem with the dbmcli-call in a cronjob

    I have a problem with a cronjob. When I started the script "recover_dbmcli.sh" with the user-id p01adm, the script running succesfully. But when i started the same script with the crontab, the script started;  but the dbmcli-command was not running T

  • My ipod keeps resetting

    and it wont stop help me ******   Windows XP   none

  • Can an ipad recognise a network hard disk

    I have saved many films movies and photos onto my Buffalo network HDD so that i can stream the media to any PC and our smart TV. I can seem to find any method  to get our iphones and ipads or Apple TVs to recognise the existance of the network drive.