Convert to DateTime

I have tried to convert '30/08/2014 12:00:00 AM' to datetime for comparison however I keep getting 'The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'.
I have been doing research for the last 3 hours and testing but can not get it to work. This is using Australian Eastern Standard Time in the Australian format.
Cheers,
Ben

I have tried to convert '30/08/2014 12:00:00 AM' to datetime for comparison however I keep getting 'The conversion of a varchar data type to a datetime data type resulted in an out-of-range value.'.
I have been doing research for the last 3 hours and testing but can not get it to work. This is using Australian Eastern Standard Time in the Australian format.
Cheers,
Ben
Hi Ben,
Try this
select CONVERT(datetime,'30/08/2014 12:00:00 AM',103)
go
Many Thanks & Best Regards, Hua Min

Similar Messages

  • Convert SSIS DateTime to a String

    Being a newbie to SSIS I'm not sure of the most efficient method of converting a DateTime object to a String.
    I'm from a C# background where this would be easy using DateTime.ToString("YYYYMMdd"). I want to use the date in a file name so don't require most of the parts.
    I'm sure I could do this using a script task to produce a file name for each row of data in my table and add that filename to the dataset but it seem like overkill to do something that should be simple. Also as I'm supposed to be getting to grips with SSIS I shouldn't keep running back to what I know.
    My current approach is to derive a column and build up an expression to convert the date into a string. The only problem being that it doesn't work.
    The expression I'm working with is:
    (DT_WSTR, 50)([OrgName] ) + "_" + (DT_WSTR, 50)( [PayrollName] ) + (DT_WSTR, 4)(YEAR( [ProcessedDate] )) + (DT_WSTR, 2)(MONTH( [ProcessedDate] )) + (DT_WSTR, 2)(DAY( [ProcessedDate] )) ".txt"
    Can anyone see where I'm going wrong?
    All comments greatly received.
    Cheers
    Ben

    Doesn't work ? What is the error you are getting ?
    Use dt_str instead. Here is an example I am using successfully...
    Code Snippet
    "FileName_" + (DT_STR,4,1252) DatePart("yyyy",getdate()) +
    Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +
    Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) + Right("0" + (DT_STR,4,1252) DatePart("hh",getdate()),2) +Right("0" + (DT_STR,4,1252) DatePart("n",getdate()),2) +".txt"

  • How to convert from Datetime to number?

    chg_date_time
    40265.492
    SELECT c.chg_date_time, TO_DATE('01011900','DDMMYYYY')+CHG_DATE_TIME FROM CHNGHIST C
    After execute:
    30/03/2010 11:48:29
    In the above query, we convert number to datetime.
    Now I want to convert from Datetime to number.
    i.e., 30/03/2010 11:48:29 = ? (40265.492)
    Thanks
    Nihar

    Hello,
    This would do it :SQL> select to_date('30/03/2010 11:48:29','dd/mm/yyyy hh24:mi:ss') - TO_DATE('01011900','DDMMYYYY') nmbr from dual;
          NMBR
    40265,492
    1 row selected.

  • Eliminating error during Convert from datetime to varchar

    I am using SQL 2008 R2.
    I am using this command:
    select Convert(varchar(12),Cast(out_date as datetime),101) From MyTable
    The output shows several rows of data and then returns an error:
    Conversion failed when converting date and/or time from character string.
    What is the syntax to eliminate errors from this select command?  Thanks
    MisterT99

    If it's a datetime, why you're converting it again to datetime?
    Why not
    select Convert(varchar(12),out_date,101) as NewDate, out_date From MyTable
    Should work just fine without extra step.
    For every expert, there is an equal and opposite expert. - Becker's Law
    My blog
    My TechNet articles

  • Convert unix datetime to GMT

    Hi,
    I am trying to convert unix date time to GMT time. Need help in doing so.
    Sample unix datetime: 1150142460
    Thanks,
    Karthik
    Message was edited by:
    rkar20

    The format that you want to see the date displayed in. And (key point here) don't forget to call the setTimeZone method of the SimpleDateFormat object to see the date formatted as if it were in GMT.

  • Error when using cast and convert to datetime

    I run a stored procedure
    usp_ABC
    as
    begin
    delete from #temp1 
    where #temp1.ResID not in 
    ( select Col1 
    from TableA 
    where ( @I_vId = -1 or Doc_Field_ID = @I_vId)
    and ColA1 = 2  and FieldValue !=''
    and cast ( FieldValue as DATETIME ) = cast (@strvalue_index as DATETIME)
    and ResID = #temp1.ResID
    and TypesId = @I_vTypeId
    end
    But return message "Conversion failed when converting date and/or time from character string.'
    Format of Column FieldValue is nvarchar(400)
    @strvalue_index = '05/05/2013'
    So I see in article http://technet.microsoft.com/en-us/library/ms174450.aspx MS say about MS SQL Server and SQL Server Compact.
    Then I re-write proc:
    delete from #temp1 
    where #temp1.ResID not in 
    ( select Col1 
    from TableA 
    where ( @I_vId = -1 or Doc_Field_ID = @I_vId)
    and ColA1 = 2  and FieldValue !=''
    and cast ( cast(FieldValue as nvarchar(200)) as DATETIME ) = cast (@strvalue_index as DATETIME)
    and ResID = #temp1.ResID
    and TypesId = @I_vTypeId
    so stored run success.
    I don't understand how?
    When i run only statement in MS SQL Studio Management, the statement run success.
    Thanks all,

    No bad dates in my data.
    Apparently you have. Or, as Johnny Bell pointed out, there is a clash with date formats. Did you try the query with isdate()?
    For SQL 2008, you need
      CASE WHEN isdate(FieldValue) = 1
           THEN CAST (FieldValue AS datetime)
      END =
      CASE WHEN isdate(@strvalue_index) = 1
           THEN CAST (@strvalue_index AS datetime)
      END
    Erland Sommarskog, SQL Server MVP, [email protected]
    I think date formats is OK. So when I re-write stored:
    and cast ( FieldValue as DATETIME ) = cast (@strvalue_index as DATETIME)
    =>
    and cast ( cast(FieldValue as varchar(200)) as DATETIME ) = cast (@strvalue_index as DATETIME)
    the stored procedure will run success. I see in http://technet.microsoft.com/en-us/library/ms174450.aspx MS
    has an IMPORTANT:
     Important
    When using CAST or CONVERT for nchar, nvarchar, binary, and varbinary,
    SQL Server truncates values to maximum of 30 characters. SQL Server Compact allows 4000 for nchar and nvarchar, and 8000 for binary and varbinary. Due
    to this, results generated by querying SQL Server and SQL Server Compact are different. In cases where the size of the data types is specified such as nchar(200), nvarchar(200), binary(400), varbinary(400), the results are consistent across SQL Server and
    SQL Server Compact.
    I can't explain it in this case

  • DateTime is stored as an int. How to convert to datetime format??

    According to the database, StartTime is stored as int: 471895438
    When Viewed in the software it comes out like this: 9/29/2010
    10:05:26 AM
    Any ideas on how to convert this using sql?
    -Tim

    I tried to play with some "reverse engineer" to get the convert value but I dont see the logic. since I dont find a pure date that fit the convert but maybe this will help:
    declare @I INT = 471895438
    declare @DT datetime = '20100929 10:05:26'
    select
    @DT
    ,DATEADD(MS, @I*(-1), @DT)
    ,DATEADD(SECOND, @I*(-1), @DT)
    --,DATEADD(MINUTE, @I*(-1), @DT) -- out of range
    (No column name) (No column name) (No column name)
    2010-09-29 10:05:26.000 2010-09-23 23:00:30.563 1995-10-16 16:01:28.000
    by those result I guess that it is in MINUTE or SECOND
    and according to those result i will need to guess that one of those convert may work for the OP:
    SELECT DATEADD(MILLISECOND, @I, '2010-09-23 23:00:30.563')
    SELECT DATEADD(SECOND, @I, '1995-10-16 16:01:28.000')
    * I tried to use datetime2 as well and check the result for microsecond and nanosecond but the solution was not better and look like 2010-09-29 10:05:25.5281046, 2010-09-29 09:57:34.1045620
    ** This is really strange if someone use a value like 2010-09-23 23:00:30.563 as a base time, and even the base value 1995-10-16 16:01:28.000 then it look strange! but maybe this is the time that the developer born or some other specific time that fits his
    needs :-)
    ** I used my birthday date (but never not a min time), several times in application that I developed as a base time :-)
    [Personal Site] [Blog] [Facebook]

  • Mediator - convert XSD datetime to SQL date value

    Fusion 11g, JDev 11.1.1, W server 2008
    Hi there,
    using JDev we've defined a DB adapter (towards an ORACLE schema), which basically serves two operations: INSERT and SELECT. On the DB table we've got a DATE_TIME while on on the other side we've defined a wsdl where the INPUT operation takes as parameter an XSD DATETIME value.
    The values have different structures and so we've started to play with the "Assign Values" function on the Mediator component, unfortunately without any success.
    Right now our expression is the following
    from
    ora:formatDate($in.newEventParam/newEventParam/ns:executionTime,"dd-MMM-yy")
    to
    $out.LogCollection/top:LogCollection/top:Log/top:when
    As first question I would like to ask you if our approach is correct and in that case what's wrong with our expression as we tried to use the same pattern as we use in SQL.
    Second, we performed some tests using the EM console. On test failure it shown a stack trace saying only that there was a problem performing a transformation. That's a bit too less, especially when transformation is done on large amount of values. Is there any way to increase trace level and get further details on which transformation didn't work out?
    Thanks in advance
    Alessandro Ilardo

    Thanks Eric for the link. That helped me to get further details about the issue but unfortunately not enough to locate the cause.
    So here I definitely have an issue with the composite application and perhaps another one on getting a SOAP trace from the Mediator log. Even with the finest log level enabled I couldn't see what the Mediator receives from outside.
    The first problem instead, seams to be a missing SOAP parameter, I assume that's why on the log I see this
    [WEBSERVICE.name: AuditService] [J2EE_APP.name: soa-infra] [composite_instance_id: 40011] Transformation failed[[
    oracle.tip.mediator.infra.exception.MediatorException: ORAMED-01203:[No Part]No part exist with name "newEventParam" in source message.Possible Fix:Review the transformation definition in mplan.Contact Oracle Support if the error cannot be fixed.
         at oracle.tip.mediator.service.transformation.XSLTransformer.getPartDocument(XSLTransformer.java:221)
    [J2EE_APP.name: soa-infra] [composite_instance_id: 40011] Got an exception: java.lang.NullPointerException[[
    oracle.tip.mediator.infra.exception.MediatorException: ORAMED-01201:[Error in transform operation]Error occurred while transforming payload.Possible Fix:Review the XSL or source payload. Either the XSL defined does not match with the payload or payload is invalid.
    In this routing there are basically 2 things that take place, an XSL mapping and an Assign value expression.
    Everything is goes fine until we perform a test from the EM, there we get the error.
    Unless someone has further tips on this issue I am considering to make a call from SOAPUI and place WS Monitor in the middle to make sure if the mistake is in the application or platform.
    External WSDL
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://xml.virtual-lab.eu/schema/poc-soa/audit/wsdl" xmlns:ns="http://xml.virtual-lab.eu/schema/poc-soa/audit/def" targetNamespace="http://xml.virtual-lab.eu/schema/poc-soa/audit/wsdl">
         <wsdl:types>
              <schema xmlns="http://www.w3.org/2001/XMLSchema">
                   <import namespace="http://xml.virtual-lab.eu/schema/poc-soa/audit/def" schemaLocation="xsd/AuditParamsDef.xsd"/>
              </schema>
         </wsdl:types>
         <wsdl:message name="addNewRequestMessage">
              <wsdl:part name="newEventParam" type="ns:add"/>
         </wsdl:message>
         <wsdl:message name="searchRequestMessage">
              <wsdl:part name="searchParams" type="ns:search"/>
         </wsdl:message>
         <wsdl:message name="searchResponseMessage">
              <wsdl:part name="returnParam" type="ns:eventObj"/>
         </wsdl:message>
         <wsdl:portType name="AuditPortType">
              <wsdl:operation name="addNewEvent">
                   <wsdl:input message="tns:addNewRequestMessage"/>
              </wsdl:operation>
              <wsdl:operation name="searchForEvents">
                   <wsdl:input message="tns:searchRequestMessage"/>
                   <wsdl:output message="tns:searchResponseMessage"/>
              </wsdl:operation>
         </wsdl:portType>
         <wsdl:binding name="AuditBinding" type="tns:AuditPortType">
              <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
              <wsdl:operation name="addNewEvent">
                   <soap:operation soapAction="urn:#addNewEvent"/>
                   <wsdl:input>
                        <soap:body use="literal"/>
                   </wsdl:input>
              </wsdl:operation>
              <wsdl:operation name="searchForEvents">
                   <soap:operation soapAction="urn:#searchForEvents"/>
                   <wsdl:input>
                        <soap:body use="literal"/>
                   </wsdl:input>
                   <wsdl:output>
                        <soap:body use="literal"/>
                   </wsdl:output>
              </wsdl:operation>
         </wsdl:binding>
         <!--
         <wsdl:service name="AuditService">
              <wsdl:port name="AuditPort" binding="tns:AuditBinding" />
         </wsdl:service>
    -->
    </wsdl:definitions>
    XSL
    <?xml version="1.0" encoding="UTF-8" ?>
    <?oracle-xsl-mapper
    <!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -->
    <mapSources>
    <source type="WSDL">
    <schema location="../AuditService.wsdl"/>
    <rootElement name="newEventParam" namespace=""/>
    <rootElementDatatype name="add" namespace="http://xml.virtual-lab.eu/schema/poc-soa/audit/def"/>
    </source>
    </mapSources>
    <mapTargets>
    <target type="WSDL">
    <schema location="../AuditBackEndService.wsdl"/>
    <rootElement name="LogCollection" namespace="http://xmlns.oracle.com/pcbpel/adapter/db/top/AuditBackEndService"/>
    </target>
    </mapTargets>
    <!-- GENERATED BY ORACLE XSL MAPPER 11.1.1.0.0(build 090618.1440.5219) AT [WED DEC 02 22:51:43 CET 2009]. -->
    ?>
    <xsl:stylesheet version="1.0"
    xmlns:top="http://xmlns.oracle.com/pcbpel/adapter/db/top/AuditBackEndService"
    xmlns:xpath20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:mhdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.mediator.service.common.functions.MediatorExtnFunction"
    xmlns:oraext="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:dvm="http://www.oracle.com/XSL/Transform/java/oracle.tip.dvm.LookupValue"
    xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
    xmlns:tns="http://xmlns.oracle.com/pcbpel/adapter/db/SOA-POC/AuditService/AuditBackEndService%2F"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:med="http://schemas.oracle.com/mediator/xpath"
    xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
    xmlns:ns="http://xml.virtual-lab.eu/schema/poc-soa/audit/def"
    xmlns:xdk="http://schemas.oracle.com/bpel/extension/xpath/function/xdk"
    xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
    xmlns:plt="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:socket="http://www.oracle.com/XSL/Transform/java/oracle.tip.adapter.socket.ProtocolTranslator"
    exclude-result-prefixes="xsi xsl ns xsd top tns plt wsdl xpath20 bpws mhdr oraext dvm hwf med ids xdk xref ora socket">
    <xsl:template match="/">
    <top:LogCollection>
    <top:Log>
    <top:who>
    <xsl:value-of select="/newEventParam/ns:fromUser"/>
    </top:who>
    <top:when/>
    <top:whichClient>
    <xsl:value-of select="/newEventParam/ns:usingClient"/>
    </top:whichClient>
    <top:whichSys>
    <xsl:value-of select="/newEventParam/ns:onSys/@ns:which"/>
    </top:whichSys>
    <top:ipClient>
    <xsl:value-of select="/newEventParam/ns:fromIP"/>
    </top:ipClient>
    <top:wsOperation>
    <xsl:value-of select="/newEventParam/ns:callingWS_Operation"/>
    </top:wsOperation>
    </top:Log>
    </top:LogCollection>
    </xsl:template>
    </xsl:stylesheet>
    Internal WSDL
    <?xml version="1.0" encoding="UTF-8"?>
    <toplink:object-persistence version="Oracle TopLink - 11g Release 1 (11.1.1.1.0) (Build 090527)" xmlns:opm="http://xmlns.oracle.com/ias/xsds/opm" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:toplink="http://xmlns.oracle.com/ias/xsds/toplink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <opm:name>AuditBackEndService-OR</opm:name>
    <opm:class-mapping-descriptors>
    <opm:class-mapping-descriptor xsi:type="toplink:object-relational-class-mapping-descriptor">
    <opm:class>AuditBackEndService.Log</opm:class>
    <opm:alias>LOG</opm:alias>
    <opm:primary-key>
    <opm:field table="LOG" name="ID" xsi:type="opm:column"/>
    </opm:primary-key>
    <opm:events xsi:type="toplink:event-policy"/>
    <opm:querying xsi:type="toplink:query-policy">
    <opm:queries>
    <opm:query name="AuditBackEndServiceSelect" xsi:type="toplink:read-all-query">
    <opm:criteria operator="and" xsi:type="toplink:logic-expression">
    <toplink:left operator="and" xsi:type="toplink:logic-expression">
    <toplink:left operator="equal" xsi:type="toplink:relation-expression">
    <toplink:left name="whichSys" xsi:type="toplink:query-key-expression">
    <toplink:base xsi:type="toplink:base-expression"/>
    </toplink:left>
    <toplink:right xsi:type="toplink:parameter-expression">
    <toplink:parameter name="sys" xsi:type="opm:column"/>
    </toplink:right>
    </toplink:left>
    <toplink:right operator="greaterThanEqual" xsi:type="toplink:relation-expression">
    <toplink:left name="when" xsi:type="toplink:query-key-expression">
    <toplink:base xsi:type="toplink:base-expression"/>
    </toplink:left>
    <toplink:right xsi:type="toplink:parameter-expression">
    <toplink:parameter name="fromWhen" xsi:type="opm:column"/>
    </toplink:right>
    </toplink:right>
    </toplink:left>
    <toplink:right operator="lessThanEqual" xsi:type="toplink:relation-expression">
    <toplink:left name="when" xsi:type="toplink:query-key-expression">
    <toplink:base xsi:type="toplink:base-expression"/>
    </toplink:left>
    <toplink:right xsi:type="toplink:parameter-expression">
    <toplink:parameter name="toWhen" xsi:type="opm:column"/>
    </toplink:right>
    </toplink:right>
    </opm:criteria>
    <opm:arguments>
    <opm:argument name="sys">
    <opm:type>java.lang.String</opm:type>
    </opm:argument>
    <opm:argument name="fromWhen">
    <opm:type>java.lang.String</opm:type>
    </opm:argument>
    <opm:argument name="toWhen">
    <opm:type>java.lang.String</opm:type>
    </opm:argument>
    </opm:arguments>
    <toplink:reference-class>AuditBackEndService.Log</toplink:reference-class>
    <toplink:container xsi:type="toplink:list-container-policy">
    <toplink:collection-type>java.util.Vector</toplink:collection-type>
    </toplink:container>
    </opm:query>
    </opm:queries>
    </opm:querying>
    <opm:attribute-mappings>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>id</opm:attribute-name>
    <opm:field table="LOG" name="ID" xsi:type="opm:column"/>
    <toplink:attribute-classification>java.math.BigDecimal</toplink:attribute-classification>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>who</opm:attribute-name>
    <opm:field table="LOG" name="WHO" xsi:type="opm:column"/>
    <toplink:attribute-classification>java.lang.String</toplink:attribute-classification>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>when</opm:attribute-name>
    <opm:field table="LOG" name="WHEN" xsi:type="opm:column"/>
    <toplink:attribute-classification>java.sql.Timestamp</toplink:attribute-classification>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>whichClient</opm:attribute-name>
    <opm:field table="LOG" name="WHICH_CLIENT" xsi:type="opm:column"/>
    <toplink:attribute-classification>java.lang.String</toplink:attribute-classification>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>whichSys</opm:attribute-name>
    <opm:field table="LOG" name="WHICH_SYS" xsi:type="opm:column"/>
    <toplink:attribute-classification>java.lang.String</toplink:attribute-classification>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>ipClient</opm:attribute-name>
    <opm:field table="LOG" name="IP_CLIENT" xsi:type="opm:column"/>
    <toplink:attribute-classification>java.lang.String</toplink:attribute-classification>
    </opm:attribute-mapping>
    <opm:attribute-mapping xsi:type="toplink:direct-mapping">
    <opm:attribute-name>wsOperation</opm:attribute-name>
    <opm:field table="LOG" name="WS_OPERATION" xsi:type="opm:column"/>
    <toplink:attribute-classification>java.lang.String</toplink:attribute-classification>
    </opm:attribute-mapping>
    </opm:attribute-mappings>
    <toplink:descriptor-type>independent</toplink:descriptor-type>
    <toplink:caching>
    <toplink:cache-type>weak-reference</toplink:cache-type>
    <toplink:always-refresh>true</toplink:always-refresh>
    </toplink:caching>
    <toplink:remote-caching>
    <toplink:cache-type>weak-reference</toplink:cache-type>
    </toplink:remote-caching>
    <toplink:instantiation/>
    <toplink:copying xsi:type="toplink:instantiation-copy-policy"/>
    <toplink:tables>
    <toplink:table name="LOG"/>
    </toplink:tables>
    <toplink:structure>structureName</toplink:structure>
    </opm:class-mapping-descriptor>
    </opm:class-mapping-descriptors>
    <toplink:login xsi:type="toplink:database-login">
    <toplink:platform-class>oracle.toplink.platform.database.oracle.Oracle9Platform</toplink:platform-class>
    <toplink:user-name></toplink:user-name>
    <toplink:connection-url>null</toplink:connection-url>
    </toplink:login>
    </toplink:object-persistence>

  • Convert displayed datetime in Flex app to database's

    I currently use Flex web services to request data from an sql
    server database (via a .net app) and bind the result set .net
    datatable to a flex datagrid. The datagrid has a datetime column
    that displays the local time at which the client created the record
    instead of the sql server datetime value. How can I change my
    datagrid records to show the database's datetime? Here's an
    articles related to this issue... but wasn't able to get it to work
    in my context:
    http://blog.shrefler.net/?p=13.
    Any help would be appreciated!

    "justneed2know" <[email protected]> wrote in
    message
    news:g980h7$m5f$[email protected]..
    >I currently use Flex web services to request data from an
    sql server
    >database
    > (via a .net app) and bind the result set .net datatable
    to a flex
    > datagrid.
    > The datagrid has a datetime column that displays the
    local time at which
    > the
    > client created the record instead of the sql server
    datetime value. How
    > can I
    > change my datagrid records to show the database's
    datetime? Here's an
    > articles
    > related to this issue... but wasn't able to get it to
    work in my context:
    >
    http://blog.shrefler.net/?p=13.
    >
    > Any help would be appreciated!
    Why not just send the request to create the record to the
    server _before_
    you do anything with it in Flex, then bring it back and
    display it in Flex?

  • Convert xsd:dateTime to UTC

    Hello community,
    Within a message mapping I have to convert a field containing date, time and timezone to UTC/GMT timezone.
    Example:
    2008-10-06T01:11:06+02:00 = Incoming value from source field, incl. local time + time zone offset
    2008-10-05T23:11:06 = Expected value of target field, incl. UTC date and time
    How can I achieve this conversion with an UDF?
    Best regards,
    Wolfgang

    Hi,
    U can chabge the time zone of the calender ussing TimeZone java class .
    Try this UDF:
    Import : java.text.*;
    UDF:
    AbstractTrace trace = container.getTrace();
    String strDate =a;// "2008-10-06T01:11:06+0200";
              Date date=null;
              SimpleDateFormat sdfSource = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
              try{          
                   String dt = strDate;          
                   date = sdfSource.parse(dt);
                   trace.addInfo("NOW1:"+date);
                   //Time Zone
                   Calendar cal1 = new GregorianCalendar(TimeZone.getTimeZone("GMT+05:30"));
                   trace.addInfo("Current Timezone="+cal1.getTimeZone().getDisplayName());
                   String timeZoneId = "UTC";//Canada/Central";  // EX.
                   trace.addInfo("Getting Time in the timezone="+timeZoneId);
                   Calendar mbCal = new GregorianCalendar(TimeZone.getTimeZone(timeZoneId));
                   mbCal.setTimeInMillis(date.getTime());
                   Calendar cal = Calendar.getInstance();
                   cal.set(Calendar.YEAR, mbCal.get(Calendar.YEAR));
                   cal.set(Calendar.MONTH, mbCal.get(Calendar.MONTH));
                   cal.set(Calendar.DAY_OF_MONTH, mbCal.get(Calendar.DAY_OF_MONTH));
                   cal.set(Calendar.HOUR_OF_DAY, mbCal.get(Calendar.HOUR_OF_DAY));
                   cal.set(Calendar.MINUTE, mbCal.get(Calendar.MINUTE));
                   cal.set(Calendar.SECOND, mbCal.get(Calendar.SECOND));
                   cal.set(Calendar.MILLISECOND, mbCal.get(Calendar.MILLISECOND));
                   Date newdt =  cal.getTime();
                   trace.addInfo("Getting Time in the timezone=####"+newdt);
                   SimpleDateFormat sdfDestination = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
                   strDate = sdfDestination.format(newdt);
                   trace.addInfo("NOW3:"+strDate);
              }catch(ParseException pe){
                    trace.addInfo("Parse Exception : " + pe);
    return strDate;
    Regards
    Ritu

  • How to convert a datetime value to UTC (or GMT)

    I have this problem.
    The user should provide the following inputs:
    - A date time value - i.e: 10 september 2006, 10:40 AM
    - The world location to which that value refers - i.e.: Rome/Italy
    I need as output, the UTC date time value:
    - i.e: 10 september 2006, 8:40 AM
    in this case it is two hours before because during summer time, the Italian timezone is GMT+2
    And if the user enters:
    - A date time value - i.e: 25 december 2006, 10:40 AM
    - The world location to which that value refers - i.e.: Rome/Italy
    The output should be: (UTC time)
    - i.e: 25 december 2006, 9:40 AM
    It only only one hour before because during winter, in italy the timezone is GMT+1
    In few words I need that Java can do by itself all the calculations about the timezone and daylight saving around different places in the world, so that I can store in my DB the universal UTC time.
    Can you suggest me some code or some good URLs?
    Thanks in advance

    I wrote this code, it works but I have still some issues.
              GregorianCalendar abroad = new GregorianCalendar(TimeZone.getTimeZone("Asia/Tokyo"));
              abroad.set(Calendar.YEAR, 2006);
              abroad.set(Calendar.MONTH, 11);
              abroad.set(Calendar.DATE, 25);
              abroad.set(Calendar.HOUR_OF_DAY, 1);
              abroad.set(Calendar.MINUTE, 0);
              abroad.set(Calendar.SECOND, 0);
              System.out.println(abroad.getTime());
            DateFormat df1 = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
              df1.setTimeZone(TimeZone.getTimeZone("Asia/Tokyo"));
              System.out.println(df1.format(abroad.getTime()));
            DateFormat df2 = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
              df2.setTimeZone(TimeZone.getTimeZone("America/New_York"));
              System.out.println(df2.format(abroad.getTime()));
            DateFormat df3 = DateFormat.getDateTimeInstance(DateFormat.FULL, DateFormat.FULL);
              df3.setTimeZone(TimeZone.getTimeZone("Etc/UTC"));
              System.out.println(df3.format(abroad.getTime()));          It outputs:
    Sun Dec 24 17:00:00 CET 2006
    luned� 25 dicembre 2006 1.00.00 JST
    domenica 24 dicembre 2006 11.00.00 EST
    domenica 24 dicembre 2006 16.00.00 UTCIn few words this code is able to compute any date from a specific timezone, to other timezone.
    My questions are:
    - Why the first output is in english ? and the other are in italian? (my OS is italian) but I didn't changed the locale in the code, so I don't understand why it outputs english text.
    - When I get the date value in other timezones, I just get a "string" computed by the "format(...)" method of the DateFormat class.
    But I really need to get something "numeric" for every specific value: minutes, hours, day of the month, month, year. Because this class will be used outside java and I don't need a string but something that the user will have formatted in his choosen locale setting for its website. (i think that I was not good to explain this point, i hope that someone can understand)
    However thank you all :)

  • How to convert SAP dateTime field to Oracle date field

    Hi All,
                We have a scenario where the incoming data is in the following format:
    < ReconciliationData >
        < RowID > 9 </ RowID > 
        < Run_ID > 7 </ Run_ID > 
        < Control_ID > 5.40 </ Control_ID > 
        < Control_Name > MTD CHARGES TO CARP ORDERS INVENTORY </ Control_Name > 
        < Start_Month > 008 </ Start_Month > 
        < End_Month > 008 </ End_Month > 
    <b>   < SAP_Time > 20070828190545 </ SAP_Time > </b>
        < SAP_Count > 4 </ SAP_Count > 
        < SAP_Amount > 5000.00 </ SAP_Amount > 
        </ ReconciliationData >
    On the receiver side is oracle database. SAP TIME field has to go into Oracle Date field. it should be transformed to structure yyyy/mm/dd hh:mm:ss format.
    How do i go about doing it?
    Regards,
    XIer

    hey
    did u try the DateTrans function?if that does not work then u can write a simple UDF for it
    http://help.sap.com/saphelp_nw04/helpdata/en/43/c4cdfc334824478090739c04c4a249/frameset.htm
    Thanx
    Aamir

  • How to convert epoch time to datetime in sql*loader Oracle

    Hello,
    I wan't to question how to convert epoch time to datetime in sql*loader Oracle. I try this script for convert epoch time to datetime in sql*loader, but error:
    Record 1: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    This is my loader:
    LOAD DATA INFILE 'C:\Documents and Settings\Administrator\My Documents\XL_EXTRACT_211\load.csv'
    into table TEMP_TEST_LANGY append
    FIELDS TERMINATED BY ','
    TRAILING NULLCOLS
    DATADATA CHAR "TO_DATE('01-JAN-1970','DD-MON-YYYY')+:datadata/86400"
    This is my csv file:
    79314313.7066667
    79314336.2933333
    79314214.3466667
    This is my table:
    CREATE TABLE TEMP_TEST_LANGY
    DATADATA DATE
    Thanks
    Edited by: xoops on Sep 21, 2011 8:56 AM
    Edited by: xoops on Sep 21, 2011 8:58 AM

    thanks for your answer, but I asked to use sql loader instead of the external table, which so my question is why can not the epochtime converted to datetime, if there is no way to convert a datetime epochtime using sql loader, so I'm required to use the external table. thank you.
    This is my error log:
    Column Name Position Len Term Encl Datatype
    DATADATA FIRST * , CHARACTER
    SQL string for column : "TO_DATE('1-Jan-1970 00:00:00','dd-MM-YYYY hh24:mi:ss') + (:DATADATA/60/60/24)"
    Record 1: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 2: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Record 3: Rejected - Error on table TEMP_TEST_LANGY, column DATADATA.
    ORA-01722: invalid number
    Edited by: xoops on Sep 21, 2011 12:33 PM

  • In OBIEE rpd convert varchar to datetime

    Hello,
    Can anyone help one how can we convert a column that is set to varchar to datetime in obiee;
    Suppose COLUMN_A is varchar and keeps value like '2008-12-30 10:11:22'
    and we want to convert it DATETIME.
    Thanks and Regards

    use cast(column as TIMESTAMP)

  • Proc C - How to convert datetime variable in Proc C into C?

    Hi,
    Does anyone know how to convert a datetime variable in Pro C into C?
    For Example,
    Order_Table with OrderId and OrderDate fields.
    How do I compare the OrderDate with the system datetime in Pro C or C?
    Thank you.

    Maybe this will help:
    http://asktom.oracle.com/~tkyte/Misc/CTime.html

Maybe you are looking for

  • FTP adapter for Oracle Service Bus  - retrieve file by dynamic file name.

    Hi I am newbie in OSB. I try to use FTP transport in Workshop, it must fill in "Prefix" and "Suffix" for destination file name. But for us, the file name is sent by external systems. The workflow is: 1. External system call our proxy services. 2. Pro

  • External speakers for Mac Mini

    I am new to this. What adapter do I need to use some Imac Flat Panel G4 speakers with my mini? They are Pro Speakers. Another topic- is there a download to make my HP 880c printer operable with this mini? thanks

  • L355 S7811 working only in Safe Mode

    I have a Toshiba L355 S7811 laptop (Vista Home Premium). I've used it for several years now but lately, it will not boot to normal Windows but to Safe Mode with network support. If I try to load it normally, it resets itself but, using Safe Mode it w

  • Icons disappear when creating a jar file.

    I am trying to make a runable jar file of an application that i wrote however, when i export it from eclipse the icons no longer appear. All of the icons are contained in a class called gridGui. Any help would be great. Thanks      //Creates all of t

  • Billing date of 2nd/4th saturday getting pushed to next working day.

    whenever my client trying to create bill of service order, bills on 2nd/4th saturday, the billing date is getting pushed to next working day. I checked their calender, they have maintained 2nd/4th saturday as holiday in holiday calender. However the