Converting a timestamp field from GMT to EST
Hi
I have to convert the timestamp field coming from the source from GMT to EST.
CREATE TABLE X
TS_FIELD TIMESTAMP(6)
INSERT INTO X VALUES('07-JAN-13 02.00.06.597000 PM');
INSERT INTO X VALUES('07-FEB-13 02.00.06.676000 PM');
INSERT INTO X VALUES('07-MAR-13 12.36.14.260000 PM');
INSERT INTO X VALUES('07-APR-13 12.36.56.713000 PM');
INSERT INTO X VALUES('07-MAY-13 03.46.48.800000 AM');
I need to convert the above timestamp field from GMT to EST in 24hour format.
I tried it doing,but I am getting hours conflict with the day error.
I have tried the below one and milliseconds being set to zero's
select X,
TO_timestamp(TO_CHAR(CAST(FROM_TZ(CAST(TO_DATE(TO_CHAR(X,'YYYY-MM-DD HH24:MI:SS.SSSSS')
,'YYYY-MM-DD HH24:MI:SS.SSSSS')
AS TIMESTAMP),'GMT') AT TIME ZONE 'US/EASTERN' AS DATE),'YYYY-MM-DD HH24:MI:SS.SSSSS'),'YYYY-MM-DD HH24:MI:SS.SSSSS')
FROM X
Please help me in this regard.I am trying in parallel as well.
Thanks in advance
KVB
Not clear what are you trying to achieve..Why are you casting as DATE?
SQL> select ts_field,
2 cast(from_tz(ts_field,'GMT') AT TIME ZONE 'EST' as timestamp) t
3 FROM X;
TS_FIELD T
07-JAN-13 02.00.06.597000 PM 07-JAN-13 09.00.06.597000 AM
07-FEB-13 02.00.06.676000 PM 07-FEB-13 09.00.06.676000 AM
07-MAR-13 12.36.14.260000 PM 07-MAR-13 07.36.14.260000 AM
07-APR-13 12.36.56.713000 PM 07-APR-13 07.36.56.713000 AM
07-MAY-13 03.46.48.800000 AM 06-MAY-13 10.46.48.800000 PM
Similar Messages
-
Has anyone done date conversion from GMT to EST with the Data API? The API for it is such a cluster-f!@*.
Calendar.setTimeZone and TimeZone look worth investigating.
-
Problems with TIMESTAMP Field from SQL Server
OBIEE 11g
Hi All,
I want to convert data into OBIEE that is coming from a TIMESTAMP field in SQL Server Database. So in SQL Server field has data like '9/20/2012 12:05:08 AM'. I have first changed the datatype in physical layer to DATETIME and then in BMM I do a CAST(<DATE_FIELD> AS DATE). On the frontend when I use this column the error I get back is [nQSError: 59030] Illegal data type conversion from source type: VARBINARY to target type: TIMESTAMP. (HY000). Does anyone know a workaround or solution.
Thanks in Advance!Hi Guys,
None of the solutions you mentioned have worked unfortunately. I have a date column and another column that holds user id. I basically want to do a count of all the user id's where that particular date column is NULL. I have checked in the physical layer and the date column in question is coming from SQL Server as a TIMESTAMP datatype. So I initially did not change anything and brought the column in as is but that did not work out. I then tried to change the datatype in the physical layer to DATETIME and then also DATE. After changing the datatype in the physical layer in the BMM I would do a CAST(<date column> as DATE) and this still did not work. I then tried to just change the datatype to DATETIME and DATE without doing the CAST in the BMM and this still did not work. Not too sure what to do now. -
Convert MySQL timestamp field to a Unix timestamp
I have a process where I want to compare the current date with an expiration date that is so many months after a registration date. The registration date is stored in a MySQL timestamp format. I want to convert this to a Unix timestame so I can do the comparison with Time(). I have tried both the MySQL UNIX_TIMESTAMP and the PHP getTimestamp() functions and cannot get them to work. I have tried UNIX_TIMESTAMP both in the original SELECT statement and as a stand alone one. I also get a divide-by-zero error with the date_default_timezone_set function. I have enclosed screenshots of the code and the result of the echo at the bottom. THANKS!
You're making it far too complicated.
SELECT TO_DAYS(reg_date) - TO_DAYS(CURDATE()) AS daysleft
FROM ssregis
WHERE. . .
That will give you the number of days left until the registration expires. If it's less than 0, redirect to the renewal page.
By the way, you're laying yourself wide open to SQL injection attacks by failing to escape the input from the query string. At the very least, you should be doing this:
$entered_ss_id = mysql_real_escape_string($_GET['record_id']);
$entered_email = mysql_real_escape_string($_GET['email_address']);
However, since it looks as though you're hand-coding the script, you should be using MySQL Improved rather than PHP's deprecated MySQL functions. See http://docs.php.net/manual/en/mysqlinfo.api.choosing.php. -
SELECT on TIMESTAMP field from ABAP with EXEC SQL
Hello,
I'm trying to get a field of one table which is defined as TIMESTAMP. MaxDB parameter DATE_TIME_FORMAT is set to INTERNAL. When I do the SELECT in SQL Studio I get ISO format 'YYYY-MM-DD HH:MM:SS.MMMMMM' back. So I tried a SELECT with ISO in WHERE clause, but I'm always getting a shortdump with this error:
Database error text........: "POS(82) Invalid date input value"
Database error code........: "-3065"
Then I did a SELECT without a WHERE clause in ABAP and got value '06-FEB-09' back from this field. So I tried with this ABAP statement and got no shortdump, but I also need to add time and not only the date.
EXEC SQL.
SELECT recv_time INTO :l_time FROM ztest WHERE sent_recv_time = '06-FEB-09'
ENDEXEC.
I'm using Native SQL because the SELECT is on a table which is not located in SAP Schema User. "SELECT recv_time FROM ztest WHERE recv_time = '2009-02-24 10:02:55.888000'" works in SQL studio, but not from ABAP.
Does anyone know which format I need to specify in the WHERE clause?
Regards
Markus Karsch
Edited by: Markus Karsch on Feb 26, 2009 4:22 PM>
Thomas Theodor Koetter wrote:
> Hello Markus
>
> I don't know whether this will work from ABAP, but at least MaxDB can internally handle the ODBC literals for time, date and timestamp.
>
> Therefore literals like
>
> "{d'0001-02-03'}"
> "{t'01:02:03'}"
> "{ts'0001-02-03 04:05:06'}"
>
> might work. See [http://msdn.microsoft.com/de-de/library/ms190234(SQL.90).aspx]
>
>
> HTH & regards Thomas
Hi Thomas,
Thanks for your help. Unfortunately doesn't seem to work, I get following shortdumps (tried with 3 different notations):
Database error text........: " "
Database error code........: "-4005"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = "{ts'2009-02-06 04:05:06'}""
Database error text........: "POS(87) Invalid keyword or missing delimiter"
Database error code........: "-3008"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = '{ts' 2009-02-06 04:05:06 '}'"
Database error text........: "POS(81) Missing value specification"
Database error code........: "-5010"
Triggering SQL statement...: "SELECT xxxxxx, status, sent_xxxx_time FROM
xxx_xxxxxxxxx WHERE sent_recv_time = { ts '2009-02-06 04:05:06.000' }"
Regards
Markus -
Converting cost center field from mandatory to optional in Tcode CRC1
Dear Experts,
I'm a PP consultant & facing a problem regarding cost center .I'm trying to test a scenario into test server where trying to create a new resource(work center) via tcode CRC1(PP-PI).
In the last screen (Costing), system is asking for the cost center which somehow couldn't be created.
Now system is not allowing to complete the resource cretaion without entering cost center(as it is maintained as mandatory field).
I want to change this setting of cost center from mandatory to optional for the sake of completeing the process (as it is being done into testing server only)
Pls let me know the way by which i can convert this mandatory entry of cost center int Optional one.
Thanks in advance ....Hi,
To add to what Ajay has said:
When you create a work center you are lead through various screens, the sequence depends on the work center category. You navigate with Next screen and Previous screen or, if you do not want to enter required data, skip."
regards
Waman -
How to change Report Server 10.1.2 from GMT to EST
We have the 10.1.2 Oracle Application Server up and running but the time on the Report Server is GMT. How can the time be changed to EST? Oracle suggested changing a value in a parameter file and a Windows environment variable, neither of which worked. Now, they are saying reinstall the Web Server. Is there any other way? How is this set during the install?
Thanks,
Davehi
it was better if you created table first.
now create table for your server name and use select into statment.
and after this if any happend you will be able to change the server name easily by
modifying table.
hope this helps u.
sarah -
Converting dat/timestamp field into desired format
Hi all
How do I convert sysdate or current_timestamp to the following format?
August 26, 2002 11:44:00 AM PDT
I am struggling mainly with the timezone portion (PDT) etc.
Would appreciate any help - Thanx!:)
Regards
Menon:)You won't be able to add the timezone to the date format itself. You'll rather have to tack on the literal string to the end of the date string.
select to_char(sysdate,'fmMonth dd, yyyy hh:mi:ss AM')||' PDT' from dual;
Armand -
CRS Editor - Retrieving Timestamp database field from SQL 2005
Hello -
For the life of me, I cannot retrieve a database timestamp field from SQL 2005.
I have successfully used 'cast(Date as char(30)) as DateStr' to convert to string but the DBRead statement displays the original object only as java.lang.Timestamp. Any posts regarding this topic usually require Java skill sets above my level (creating new java class for import,...).
There has to be an easy way to do this without being a Java programmer, yes?
Any help here would greatly be appreciated!
Thanks
Andy Backus
941.587.7199Andy,
I'm guessing you know that this isn't really a date/time value in MS SQL. According to Microsoft:
The Transact-SQL timestamp data type is not the same as the timestamp data type defined in the SQL-92 standard. The SQL-92 timestamp data type is equivalent to the Transact-SQL datetime data type.
But to your question how to get the timestamp value out in a string...You'll want to use the convert function:
select convert(varchar(10),myTimestampField) from myTable
That will return the hex value in the column in a string format. Also, when you retrieve the data, are you looking at the original table (which specifies the column is a timestamp), or did you create a dummy table with the columns named and formatted the way the data will be returned that UCCX can look at for the schema? If it doesn't have the correct schema to look at, you'll have problems.
Cliff
please rate helpful posts -
Storing the Timestamp field in the Table
Hi
I have a Z program and we need to store the timestamp field in the Z table . I have created the table with the dataelement
TIMESTAMP . Is there any system field that can be used to store the timestamp field from your program
say for example we have declared a work area of the structure of the Z table and Appended through the Internal Table and Modified that Z table.
My intention is store the Timestamp field in the Z table.
NadeshHi,
you can add as below..
types : begin of st_output.
include structure ztaxinvoice.
FKIMG1 TYPE VBRP-FKIMG,
FKIMG2 TYPE VBRP-FKIMG,
types : end of st_output.
or you can add this field to your structure 'ztaxinvoice' as below
'FKIMG1 TYPE FKIMG'
'FKIMG2 TYPE FKIMG'
Then you can declare internal table and work area as mentioned below..
data: it_output type standard table of ztaxinvoice,
wa_output type ztaxinvoice.
here in this case no need of types declaration also you can pass the same type (wa_output type ztaxinvoice) in smartform.
hope this will help you,
Regards,
Renuka S. -
Oracle SQL HELP with convert GMT to EST and DST and Date offset
Hi, I have a query that does not seem to work trying to convert a date field that is in GMT to est and using extract(timezone_hour FROM TO_TIMESTAMP_TZ as an offsetr
HEre is my sql
dtl.start_dt_gmt + (extract(timezone_hour FROM TO_TIMESTAMP_TZ( dtl.start_dt_gmt,'DD-MON-YYYY HH24:MI:SS TZH:TZM'))/24 ) START_DT_Local
If the date (dtl.start_dt_gmt) is may 1 and gmt starts at 04:00 AM , the extract offset produces -4
However, if the date (dtl.start_dt_gmt) is Feb 1 which begins at 05:00 AM GMT, the date offset still gives 04. What am i doing wrong? Any help would be appreciated. Thanks.
SaulIf your data is not associated with timezone then you'll have to use something like
case when dt between A and B then dt-1/24 else dt end; <-- This will give you 1 hour back of EDT. So, as far as concern at database level, it is nothing to do at db level, because db is used by application, so you need to code in the app.
Oracle never actually changes a TIMEZONE column value when you set your system to be on daylight savings time. There are several built-in DST DATE conversion functions for changing to daylight savings time:
current_date
current_timestamp
localtimestamp
dbtimezone
sessiontimezone
extract
from_tz
to_timestamp
to_timestamp_tz
to_yminterval tz_offset
http://dba-oracle.com/t_oracle_daylight_saving_time_dst_date_conversion.htm
Regards
Girish Sharma -
Problem with selecting from timestamp field for a particular date
We're running 10g and we have a timestamp field whose values look like this:
SQL> select timeinserted from files where rownum < 3;
TIMEINSERTED
16-APR-05 01.08.35.97634 PM
16-APR-05 01.16.10.00419 PM
SQL>
I'm trying to run this query, but it returns no rows even though I know there should be some:
select timeinserted from files where timeinserted = '27-MAY-05';
I know I just need to somehow tell it to convert the timestamp to date or something like that. How should I rewrite this query? Thanks...select timeinserted from files where timeinserted = '27-MAY-05';
this is poor coding, you compare a date with a varchar2. Not to mention using 2 digits years...
try something like
select timeinserted from files where timeinserted >= to_timestamp('27-MAY-2005', 'DD-MON-YYYY') and timeinserted<to_timestamp('28-MAY-2005', 'DD-MON-YYYY'); -
How to Convert GMT in EST timezone
We are comunicating with a system,which send date and time in this format - GMT Date and time in YYYYMMDDHHMISS where HH is 24 hour format.Our server has EST (US) time zone. Now I have to validate if the received time stamp from our client is with in +/- 5 minutes, we need to allow him to do some operation.So How can I compare the time stamps in GMT and EST.Which java classes I need to use to accomplish it, any code snippet wil be hepful
thanks in advance
paryTry this it may help you.
Date date = new Date();
DateFormat estFormat = new SimpleDateFormat();
DateFormat gmtFormat = new SimpleDateFormat();
TimeZone gmtTime = TimeZone.getTimeZone("GMT");
TimeZone estTime = TimeZone.getTimeZone("EST");
estFormat.setTimeZone(gmtTime);
gmtFormat.setTimeZone(estTime);
System.out.println("GMT Time: " + estFormat.format(date));
System.out.println("EST Time: " + gmtFormat.format(date));Result::
GMT Time: 10/5/05 5:37 AM
EST Time: 10/5/05 1:37 AM -
Acrobat X (Windows) is converting all fields from the Word table - making even the imported bookmarks editable. We just want the check boxes interactive. This has to be done on a large volume of documents, so it needs to be automated. I suspect some coding will be involved or perhaps a 3rd party app that allows one to selectively convert fields.
Thanks!Ok, I found out that I need to apply the patch 5746875 to have that. But there only instruction to apply this patch on unix env. I need on Windows. Can any body help me?
-
Convert a field from dropdown to checkbox
Hi experts,
Can anyone please let me know how to convert a field from dropdown to checkbox.
Regards,
AshwiniHi,
Modify GET_P method insert the below coding
case iv_property.
when if_bsp_wd_model_setter_getter=>fp_fieldtype.
rv_value = cl_bsp_dlc_view_descriptor=>field_type_checkbox.
endcase.
Regards,
Arun Kumar
Maybe you are looking for
-
How do I make a view object containing two entity objects updatable?
I have a view object that contains attributes from two entity objects. The query looks like this SELECT AplCfgPartyEO.ID, AplCfgPartyEO.ID_HRM_BRW_JOB, HrmBrwJobEO.CREATED_BY, HrmBrwJobEO.CREATION_DATE, HrmBrwJobEO.ID AS ID1, HrmBrwJobEO.ID_HRM_BAS_J
-
Why are so many songs duplicated in my library?
Just recently lost hard drive to failure. Replaced drive and reloaded ITunes. Now I have many many songs that are duplicated in my library.......almost all of them! Does this mean that I have duplicates in my ITunes music folder, or that I have mo
-
Urgent:Regarding data reconsilation
HI all, 1. i have PSFT as trusted source and EBS as target source. now when we connect to this sources by using out-of-the-box connectors which is already avilable,what it will ask while installing connectors and which tables it is going to connect?
-
My Wrt54gs blocks secured sites and games.
I have posted here before and got no help, it blocks any site that has https and even blocks me from connecting to: Warcraft 3, hamachi, and anything with an http popup. It is connected to with ethernet wires, and i have done power cycles countless t
-
Viewing videos or viewing pics?
I am wondering if anybody knows why I cant view some videos from online or view some pics I get in emails with a Mac. I already downloaded QT. Do I have to download anything else? Is real player downloadable to Mac? any help would be appreciated.