How to convert date-time according to the Time Zone the client
Urgent! Help wanted!
I extract a date-time field (which is GMT time) from the central database but I need to convert it accordding to the TimeZone of the user and also the so-called winter time and summer time in the local. Any one has any good solution?
Thanks.
Use a Calendar, Timezone and Locale objects like this,
TimeZone tz = TimeZone.getTimeZone("Germany/Berlin");
Calendar cal = Calendar.getInstance(tz, Locale.GERMAN);
long date = 0; // assign your central database value to this variable
cal.setTime(new Date(date));
Now you can use the Calendar object 'cal' to retrieve the time according to the set locale and timezone.
These objects provide tonnes of features for finding out timezones and day light savings times. So check out the APIs as well.
I hope this helps you out.
Similar Messages
-
How to Change Date Format according to the Locale/Country of Portal User
Hi,
In a webdynpro applicaiton, how to chage the Date Format according to the Locale/Country of Portal User.
Consider for INDIA: mm/dd/yyyy
Consider for UK: yyyy/mm/dd
So when i select the date from the Date Picker[input ui element bound to date context variable], the date format should be displayed accroding the portal users country/locale.
Creating a simple type for every date format in the dictionary would not be the right solution.
Please help.
Thanks,
Regards,
Aditya MetukulHi Aditya,
Check out the following post in SDN and refer the
Bertram's reply on the same topic.
date format
Regards,
Shubham -
How convert date/time from xml in xdp(Designer)?
Hi, i want to convert date/time format from xml in Designer, date/time value in xml is NOT in common format YYYY-MM-DD (if is in a common format i can do this with pattern)
I have a "DateTime" Field in Xdp can get from Xml date and time:
In XML <DateTime>DD-MM-YYYY</DateTime> i want to convert in XDP in DateTime Field in "DD-April-YYYY"
Can i do this?You can do this way..
Bind the date field to your XML tag.
Set the display pattern for the date field.
In the initialize event of the date field place the following code.
Set JavaScript as language.
var dtStr = this.rawValue;
var pos1=dtStr.indexOf("-");
var pos2=dtStr.indexOf("-",pos1+1);
var strMonth=dtStr.substring(0,pos1);
var strDay=dtStr.substring(pos1+1,pos2);
var strYear=dtStr.substring(pos2+1);
//Assign the formatted value to the Date field.
this.rawValue = strYear + "-" + strMonth + "-" + strDay;
Thanks
Srini -
How to Convert Date (DD.MM.YYYY) to be just DD
Hi experts,
I have no idea how to convert Date format (DDMMYYYY) to be just DD.
Example:
I have date: 31.10.2009
now i just want to show in report as 31.
I just known if we just want to show month only, we could use the 0CALMONTH2. but how if i need the day only?
Are there any way, either in query (BEx) or modeling (Routine/Formula in Update Rules or Transfer Rules) which could fulfill the requirement?
Many thanks..
Warm Regards,
TikaHi,
go through the link below and modify according to your requirement
Date conversion from YYYYMMDD to DD.MM.YYYY
Regards,
Marasa. -
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 AMthanks 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 -
How to Convert Date to Month in Database which is pointing to EBS, Not DWH.
Hi Friends,
We are planning to create reports in OBIEE and the Source is EBS. That means, we don’t want to depends on Datawarehouse and Informatica and OBIApps. We just create some reports and they are pointing to EBS database.
For testing purpose, we have taken one HR Report and it containsthe below columns:
Month (Dim)
Revenue Per Employee Headcount (Fact)
Average Cost per Active Workforce Headcount (Fact)
In my little investigation, we found that Revenue column is coming from EBS: GL_BALANCES. And we configured W_Day_D base table in DAC as there is no Month column in EBS (Not sure).
*** Coming to my problem, how can I call Month column in my database pointed to EBS. How to convert Date to Month in my database.
I could be wrong but anyone please look into this issue.. How can I create columns for that exact OBI report in EBS database instead of DwH.
Thanks in Advance..
Raghu NagadasariHi Veeresh,
You are right. Here, no need of using W_DAY_D table, but, we need all the stuff from the table and to explain my problem i have taken that table as an example. Now, we ran scripts for W_MONTH_D and W_DAY_D tables with EBS columns. So, we are getting data for the tables. In the same manner we have to create scripts for the below tables.
W_GL_ACCOUNT_D
W_GL_OTHER_F
W_STATUS_D
W_MCAL_DAY_D
W_EMPLOYMENT_STAT_CAT_D
W_WRKFC_BAL_A
W_DAY_D (Completed)
W_MONTH_D (Completed)
But, we are not aware of EBS Tables and their columns much. So, we are back tracing from RpD --> DAC --> Info --> EBS for each and every column and its taking much time.
So, if anyone of you facing the same issue, please share the EBS tables for the corresponding OBI tables, which are mentioned above. -
How to print date & time stamp on photos?
How to print date & time stamp on photos?
Three methods:
File>process multiple files>labels. Be sure to uncheck "same as source", or the originals will be overwritten. It is best to work on duplicate files, esp. while learning.
Use the horizontal or vertical type tool to add the information manually to each picture file
If the same information is to be applied to several pictures, e.g. a copyright notice, use of a brush made in PSE is very efficient -
How to print date/time in report page footer?
Hi
I have a report which users can print as PDF.
However, I like to display current date/time in report footer.
I can see the Page Footer in section but can't figure out how to print date/time there.
Thanks for help.hi movilogo
Please try this.
Create hidden item P1_DATE
Create On load process in page 1 and put this code
begin
:P1_DATE:=TO_CHAR(SYSDATE,'DD-MON-YYYY HH:MM:SS');
end;
Open your region in Page 1 put this code in Footer area
*&P1_DATE.*
Refresh your page.
you will get the output like this.
16-SEP-2009 11:09:17
thanks
Mark Wyatt -
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 dd.mm.yy into yyyymmdd?
Hello experts,
how to convert date format dd.mm.yy into yyyymmdd?
Thanx
AxelHi
go through these previous threads on similar question
https://forums.sdn.sap.com/click.jspa?searchID=673529&messageID=1763194
Date Conversion in Flat File
converting the DATE(yyyymmdd) into MONTH(yyyymm) format
Date Format Conversion from MM.DD.YYYY to YYYYMMDD
gives clear idea
Reagrds
Kiran
Message was edited by:
ravi kiran naalla -
Convert date time local Timezone to GMT
I need to get GMT time...
How to convert local time to GMT ?
public static long getGMTNow()
Calendar local = new GregorianCalendar();
local.set(Calendar.HOUR_OF_DAY, 0);
local.set(Calendar.MINUTE, 0);
local.set(Calendar.SECOND, 0);
System.out.println(local.getTime());
System.out.println(local.getTimeInMillis());
Calendar gmtC = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
gmtC.setTimeInMillis(local.getTimeInMillis());
System.out.println(gmtC.getTime());
return gmtC.getTimeInMillis();
}Result :
Thu Feb 12 00:00:00 EST 2009
1234414800034
Thu Feb 12 00:00:00 EST 2009
1234414800034Calendar gpsTime = new GregorianCalendar(TimeZone.getTimeZone("GMT"));
gpsTime.set(Calendar.HOUR_OF_DAY, 10);
gpsTime.set(Calendar.MINUTE, 0);
gpsTime.set(Calendar.SECOND, 0);
System.out.println("gpsTime: "+gpsTime.getTime());
Calendar realtime= new GregorianCalendar();
realtime.set(Calendar.HOUR_OF_DAY, 5);
realtime.set(Calendar.MINUTE, 0);
realtime.set(Calendar.SECOND, 0);
System.out.println("realtime: "+realtime.getTime());
System.out.println("COMPARETO : "+ realtime.compareTo(gpsTime));
long timediff = realtime.getTimeInMillis() - gpsTime.getTimeInMillis();
System.out.println(timediff/1000 + " sec");RESULT :
gpsTime: Mon Feb 16 05:00:00 EST 2009
realtime: Mon Feb 16 05:00:00 EST 2009
COMPARETO : 1
0 secOk, I done my homework. getTime() will allways return local time so I need to set the GPS time to a GMT Calendar to get the right result.
Funny thing, look at the compareTo result.... -
How to convert date (dd/mm/yyyy) to week no. calendar?
hi all,
I have a question about if user enters 12/12/2004(dd/mm/yyyy), which week is that? I just know week no. should from 01 to no more than 53. How to convert date to week no.?
Thanksselect to_char(sysdate,'IW'),to_char(sysdate,'wW') from dual;
for IW, the week 2 starts on the first monday after 1.Jan, for WW, the week 2 starts on 8. Jan.
HTH
Laurent Schneider
OCM DBA -
How to convert date to ccyymm format
Hi,
How to convert date to ccyymm format.
Thanksdadivela wrote:
Re: How to convert date from ccyymm format to mmddyyI didn't inderstand. Date doesn't have any format. If you have a string in CCYYMM format, you would have to extract the YYMM from the string.
SQL> SELECT SYSDATE,
2 TO_CHAR (SYSDATE, 'ccyymm') Date_Fm,
3 SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3) YYMM
4 FROM DUAL
5 /
SYSDATE DATE_F YYMM
08-JUN-09 210906 0906You can use this string to convert it to date. Note that since DD part of your date was not their in the resultan string, the converted date will fall back to first of the month specified.
SQL> SELECT SYSDATE,
2 TO_CHAR (SYSDATE, 'ccyymm') Date_Fm,
3 SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3) YYMM,
4 TO_DATE (SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3), 'YYMM') conv_Dat
e
5 FROM DUAL
6 /
SYSDATE DATE_F YYMM CONV_DATE
08-JUN-09 210906 0906 01-JUN-09
SQL>Then convert the date into the required format using TO_CHAR Function
SQL> SELECT SYSDATE,
2 TO_CHAR (SYSDATE, 'ccyymm') Date_Fm,
3 SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3) YYMM,
4 TO_DATE (SUBSTR (TO_CHAR (SYSDATE, 'ccyymm'), 3),
5 'YYMM') conv_Date,
6 TO_CHAR(TO_DATE(SUBSTR(TO_CHAR (SYSDATE, 'ccyymm'),3),
7 'YYMM'), 'MMDDYY') New_Format
8 FROM DUAL
9 /
SYSDATE DATE_F YYMM CONV_DATE NEW_FO
08-JUN-09 210906 0906 01-JUN-09 060109
SQL>Hope this helps.
Regarads,
Jo -
How to convert date to milliseconds?
hi,
can anybody tell me how to convert date to milliseconds.
thanks,
ayathasSee milliseconds and time properties:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/Date.html -
How to convert DATE variable to CHAR variable
dear all,
How to convert DATE variable to CHAR variable
thanqDepending on your final goal here are 2 options.
DATA: datein TYPE d.
DATA: dateout(10) TYPE c.
DATA: dateout2(8) TYPE c.
datein = sy-datum.
WRITE datein TO dateout MM/DD/YYYY.
dateout2 = datein.
WRITE:/ datein, dateout, dateout2.
and the output
05022008 05/02/2008 20080502
Maybe you are looking for
-
Moved my mac over to a new HD and my Windows Partition no longer boots.
Hello people smarter than me. I seek knowledge and skills I do not posses. I replaced my SSD with a bigger one going from 240gb to 960gb. The old one had two bootcamp OS partitions (Mac, Windows) and four partitions (EFI System Partition, Recovery
-
My time machine keeps saying the backup disk cannot be mounted. how do I fix it?
my time machine keeps saying that the backup disk cannot be mounted. we cannot figure out why this is happening. We have a 500GB time capsule /wireless router and using a Macbook . any ideas?
-
Wireless Ethernet suddenly not working!
Hi everyone. I've noticed some similar problems posted but I believe mine has a unique twist. Two nights ago my powerbook stopped being able to connect to my G5 desktop via wireless. Now, before I explain my whole set up, the catch is this: Not only
-
Hi, I have a basic knowledge of SQL an pl/sql so out of these two which certification should i take i am confused..other than exam topics is there any difference.... EXAM 1Z0-047 Oracle Database SQL Expert or 1Z0-051 Oracle Database 11g: SQL Fundamen
-
Could anyone check this code for errors for me??
Hi! Could someone please tell me if you see any problems with this code?? a friend wants me to check it for errors, but can't find any. I just wanted to make sure, because there are probably a lot of better scripters than me reading this. Please answ