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

Similar Messages

  • 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';

  • 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.

  • 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

  • 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)
    ----------------------------------------------------------------

  • How can I convert date in FOX (from DEC to date[DEC])

    Hi everyone!
    In my planning layout I have a field called "MYDATE" of the date-type "DEC: Calculation or amount field with comma and +/- sign" (-> BPS does not allow using DATS as date-type).
    Since I import that date from a different system, I have to use a temporary workaround field "WADATE" (WorkaroundDate) of type DEC (alternatively integer or float) which contains the date in a format YYYYMMDD (e.g. 20070604).
    How can I transfer the date from WADATE to MYDATE? I tried using FOX, but for some reason it does not work. When I use the following function, MYDATE remains empty:
    DATA TMPDATE TYPE F.
    DATA MYPROJECTS TYPE B906_PROJ.
    FOREACH MYPROJECTS.
    "MYDATE" is the field I want my date in
    "WADATE" is my workaround field that contains the date
    TMPDATE = {WADATE,000,0000000001,0000000001,001}.
    BREAK-POINT.
    {MYDATE,000,0000000001,0000000001,001} = TMPDATE.
    ENDFOR.
    Is it possible to solve my problem with FOX? Or do I have to work with an EXIT function?
    Best regards, Daniel

    Daniel,
    The better approach is the one Marc said but if you have tomake a work around work, I think you might need to try and define your temporary date variable as String and another for the converted date as of type of the final date.  I would not define any date type as float unless you can have part days and it is very important to have part days, integer might work by I would try String first myself.
    It has been a while but on a BW 3.5 project I had to do some manipulation to read the attribute value of material master data to get the launch date and use it to derive the start period (definited as type 0FISCPER) and proportion of month based on number of days remaining after launch date vs the # of days for the month.  I think I used string type function in FOX to derive some of the component...
    Hope this helps,
    mary

  • Crystal Data Conversion Issue (Error converting data type varchar to datetime)

    Hi,
    I can run stored procedure without error in SQL Server using my personal credentials as well as database credentials.
    I can also run Crystal Report after connecting to Stored procedure without error on my desktop using my personal credentials as well as database credentials.
    But when I upload the crystal report in BOBJDEV and when I run using database credentials report fails saying that "Error in File ~tmp1d1480b8e70fd90.rpt: Unable to connect: incorrect log on parameters. Details: [Database Vendor Code: 18456 ]" but I can run the crystal report successfully on BOBJDEV using my personal credentials.
    I googled (Data Conversion Error Message) about this issue & lot of people asked to do "Verify Database" in Crystal Report. So I did that, but when I do it I am getting a error message like this:
    Error converting data type varchar to datetime.
    Where do you think the error might be occurring? Did anyone faced this kind of issue before? If so, how to resolve it?
    (FYI, I am using Crystal Reports 2008, & for stored procedure I have used SSMS 2012 )
    Please help me with this issue.
    Thanks & Regards.
    Naveen.

    hello Naveen,
    since the report works fine in the cr designer / desktop, we need to figure out where you should post this question.
    by bobjdev do you mean businessobjects enterprise or crystal reports server? if so please post this question to the bi platform space.
    -jamie

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • Convert data in the text file to table in DBL

    Hi guys
    I wanted to convert data in text file which are in multiple rows and columns in DBL format to a table to b seen in labview as DBL format.
    I had tried looking and working at the example but in vain , i just cant produce anything
    pls help. or write me a short example..thanks

    Are you dealing with a table or an array.  For an array, just use the Read spreadsheet file from the File I/O palette.
    For a table,  you will have to convert the number to a string and setting the appropriate precision and width, then write the 2-D string array to the table.
    Message Edited by Ravens Fan on 05-20-2008 11:54 PM
    Attachments:
    Example_VI_BD6.png ‏3 KB

  • Syntax error while doing Convert data in LSMW

    Hi experts,
          I am using direct input method for uploading customer master records. After display read data step, when i click Convert data button, i get a runtime error saying that:
          the data object "LEGACY_CUSTOMER_MASTER" has no component called "OLD_CUST_NO", but there is a component called "SAP_CUST_NO".
        But actually we do not need OLD_CUST_NO field, so i did not include it while maintaining source fields. Someone plz help. I urgently need to resolve this.
    Thanks.

    Hi ,
    I think you have declared the filed old_cust_no in the maintain field mapping step may be in global declaration or in the mapping section of hte field. Without the use of filed OLD_CUST_NO you wont get the syntax error. Check the sysntax error in field mapping step and delete the unwanted field.Check the filed mapping section carefully based on the error.
    Thanks.

  • How to convert date dd.mm.yyyy TO Month ddth YYYY?

    hi friends,
    how to convert date into this format.
    ex:
    date : 04.11.2008
    has to convert as
    October 04th, 2008
    th has to be set SUPERSCRIPT.
    Plz any helps....
    Regards,
    Shankar.

    check this..FM
    CONVERT_DATE_TO_EXTERNAL
    or we can do this using split or concatenate functions like below
    *CALCULATING THE MONTH FOR THE BODY OF THE EMAIL MSG
      IF GD_EBODY_BB = '01' .
        GD_EBODY_BB = 'January' .
      ELSEIF GD_EBODY_BB = '02' .
        GD_EBODY_BB = 'February' .
      ELSEIF GD_EBODY_BB = '03' .
        GD_EBODY_BB = 'March' .
      ELSEIF GD_EBODY_BB = '04' .
        GD_EBODY_BB = 'April' .
      ELSEIF GD_EBODY_BB = '05' .
        GD_EBODY_BB = 'May' .
      ELSEIF GD_EBODY_BB = '06' .
        GD_EBODY_BB = 'June' .
      ELSEIF GD_EBODY_BB = '07' .
        GD_EBODY_BB = 'July' .
      ELSEIF GD_EBODY_BB = '08' .
        GD_EBODY_BB = 'August' .
      ELSEIF GD_EBODY_BB = '09' .
        GD_EBODY_BB = 'September' .
      ELSEIF GD_EBODY_BB = '10' .
        GD_EBODY_BB = 'October' .
      ELSEIF GD_EBODY_BB = '11' .
        GD_EBODY_BB = 'November' .
      ELSEIF GD_EBODY_BB = '12' .
        GD_EBODY_BB = 'December' .
      ENDIF .
    *ATTACHMENT SUBJECT LINE MODIFICATION
      IF GD_EBODY_CC = '01'.
        CONCATENATE GD_EBODY_CC 'st' INTO GD_EBODY_CC .
      ELSEIF GD_EBODY_CC = '02' .
        CONCATENATE GD_EBODY_CC 'nd' INTO GD_EBODY_CC .
      ELSEIF GD_EBODY_CC = '03' .
        CONCATENATE GD_EBODY_CC 'rd' INTO GD_EBODY_CC .
      ELSEIF GD_EBODY_CC = '31'.
        CONCATENATE GD_EBODY_CC 'st' INTO GD_EBODY_CC .
      ELSEIF GD_EBODY_CC = '21'.
        CONCATENATE GD_EBODY_CC 'st' INTO GD_EBODY_CC .
      ELSE .
        CONCATENATE GD_EBODY_CC 'th' INTO GD_EBODY_CC .
      ENDIF .
    regards
    ansumesh
    Edited by: Ansumesh Kumar Samal on Nov 4, 2008 9:02 AM

  • How to convert date format(mm/dd/yy) into dd-mm-yy

    I want to convert date format(mm/dd/yy) into dd-mm-yy
    like 12/23/06 into 23-sep-06

    hey, you can use SimpleDateFormat to format your date. this is sample code, maybe could help you.
    class dateFormat
         public static void main(String[] args)
              Date now = new Date();
              System.out.println("Before format : "+now);
              SimpleDateFormat sdf = new SimpleDateFormat( "dd-MM-yy" );//Change your date format in here.
              String display = sdf.format(now);
              System.out.println("After format : "+display);
    }If you already understand about my sample code, i think it's easy to make your own date format. Just modified few line of my code.

  • How to convert date from "yyyymmdd" to "MM/DD/YYYY" format

    1. I have one BLDAT field in my internal table.
       its getting updated from input file.
    2. The value in the input file is like yyyymmdd.
       So the internal table field is filled like this
       "YYYYMMDD".
    3. After this,I have to compare this internal table  
       field with BSAD table.
    4. The BLDAT field in BSAD table is in the format of 
       "MM/DD/YYYY".
    5. the BLDAT field is having diff format in internal  table and BSAD table.So I am unable to check this value.
    How to convert it as like the BSAD table format."MM/DD/YYYY" format.
    Thanks in advance!!

    Using the WRITE statement
      data: gd_date(10).  "field to store output date
    * Converts date from 20020901 to 09.01.2002
      write sy-datum to gd_date mm/dd/yyyy.
    OR u can
    CONCATENATE gd_date+4(2) gd_date+6(2) gd_date+0(4)
    into gd_date seperated by '/' .
    Hope this helps.
    Kindly reward points and close the thread for the
    answer which helped u OR get back with queries.

  • To convert date dd/mm/yyyy in Timestamp format

    hi
    I want to convert date of format dd/MM/yyyy, which get from user by PropertyUtils.getSimplePropetrty(form, "startDate"); , into Timestamp format...........
    please help me in this regard.......
    1904

    ya mean it from java.sql.Timestamp
    and also I am using getTime() method but giving
    root cause:
    org.apache.commons.beanutils.ConversionException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
    and
    Caused by: java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd hh:mm:ss.fffffffff
    at java.sql.Timestamp.valueOf(Timestamp.java:160)
    at org.apache.commons.beanutils.converters.SqlTimestampConverter.convert(SqlTimestampConverter.java:157)

  • Reg: Convert Data in LSMW

    Hi,
    Upload Purchase Order data using multiple flat file through LSMW
    in LSMW it's working fine upto Display Read Data.
    After that enter into the convert Data it will ask the Transaction Number.
    I didn't understand what's related Transaction Number.
    I tried to enter the some values it will show the error like "Use Date format in the user master". After that i tried to enter the date formate but it's not working and shows blank .
    Please anybody help me regarding this transaction number
    Thanks & Regards.
    Edited by: Praveen SatyaSai on Dec 28, 2011 3:28 PM

    If you leave it empty, all your records will be converted. If you enter 1, the first set of records (or transaction) will be converted.
    basically, you can use it to only convert a specific set of data (or transaction).

Maybe you are looking for

  • Datasource for material wise production data

    Hi Gurus, I need to extract daily production data from ECC material & plantwise. So which datasource I need to use for it? Its for a steel industry. Of the below ones which datasources can I use? & which DSO & Cube can I consider?\ 2LIS_04_P_COMP 2LI

  • Problem transporting data source on R/3 side - missing text

    Hi guys We are trying to transport a BC data source with enhancement from DEV to TEST. The person doing the enhancement is long gone. When we try to include the data source in a transport, we get the error: "The short text of data source … is not mai

  • Unable to access external drive.

    I'm a newbie to macs. Tried to use my Maxtor One Touch III USB external hard drive which had previously been my windows backup drive, on my new mac. Copied all the files to the mac, reformatted it with Mac Extended and then copied the files back over

  • SP2-0423 Illegal get command

    When I try to run a file using SQL Plus I get SP2-0423 Illegal get command. Can someone help me with this. I have tried uninstalling and reinstalling and it is not fixing the error. Thanks in advance for any help.

  • I've suddenly lost my airport network

    i was trying to sort out a problem with xbox live and was fiddling with a few internet settings. i didn't really know exactly what i was doing. i've managed to do something that's disabled my airport. i can't detect the network at all now. Any sugges