GMT and Date

I am reading a date from an XML file. The date is specified in GMT. I want to create a Date object in GMT based on this value, and not on the local time zone. How do I do this easily? I know I can find out what time zone I'm in and add some value (or subtract) to get GMT, but I can't believe there is not some simple way to create a Date object in GMT.

There is:
// Get Locale
Locale locale = Locale.getDefault();
// Create timeZone object
TimeZone tzTimeZone = TimeZone.getTimeZone("GMT");
//Create Calendar object
Calendar calCalendar = Calendar.getInstance(tzTimeZone);
// Create DateObject
DateFormat dateFormat = DateFormat.getDateInstance(DateFormat.DEFAULT, locale);
dateFormat.setTimeZone(tzTimeZone);
// Get current time
Time tmLastLogin = rs.getTime("LastSignOn");//this was a time object read from a database but you can create it here
// Set time in our calendar object
calCalendar.setTime(tmLastLogin);
calCalendar.set(Calendar.YEAR,dtLastLogin.getYear()+1900);
calCalendar.set(Calendar.MONTH,dtLastLogin.getMonth());
calCalendar.set(Calendar.DAY_OF_MONTH,dtLastLogin.getDate());
calCalendar.setTimeZone(tzTimeZone);
// Get our Date Object
java.util.Date dt = calCalendar.getTime();
// Get our GMT String representation
String dtString = dt.toGMTString();
This code is used in a servlet that displays to the user the last time he or she logged into the system in GMT time.

Similar Messages

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

    If 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

  • Report Scheduling. How to syncronize the GMT and the local server timezones

    Hi everybody, I need to schedule reports using the Schedule tab on BIP, but I didn't still understand how the syncronization between my server's timezone and the GMT timezone works.....
    I noticed that when I open the Report Schedules initial page, this is refreshed using the GMT timezone as follows:
    Page Refreshed   Monday, July 26, 2010 7:53 AM GMT
    Actually I'm located in Athens (GMT+3)
    I noticed that if I want to Run once a report, ONLY the GMT is took in consideration.
    For example, I want to run a report at 11.30 (Athens timeone) where the time conditions are the following:
    BIP time (GMT timezone): 08.00 AM GMT
    server timezone: 11.00 AM (Athens time)
    So, if I want to run a report at 11.30 AM (Athens time), I have to write in BIP (Run once) 08.30 AM, instead of 11.30, otherwise if I put 11.30, the report runs 3 hours and 30 minutes later instead of only 30 minutes !!! This is very frustrating....because it means that everytime I need to remember that there is a difference of 3 hours and if I want effectively....
    I also set the Report Formatting Time Zone = GMT+03:00 to fill the gap between the GMT's timezone and Athens's timezone but it didn't work....
    I found that the variable <xsl:param name="_XDOTIMEZONE">GMT</xsl:param> is set into the tmpl.xsl; I tried to change it (GMT+3 or GMT+03:00), I stop and restart the BIP server....but nothing...the BIP timezone is always GMT (as showed by th Page Refreshed date and time).
    At the end my question is this: is there a way to modify the internal BIP timezone in order to fill the gap between this and the server timezone ?
    In other words, I'd like to see the page refreshed with the server timezone (Athens timezone) and not the GMT timezone, in order to schedule reports thinking directly my local server timezone (and not think always to calculate how many hours is the difference).
    This, I think is a common issue for everybody, but....I didn't find nothing in the forum....
    If somebody found a workaround, every help will be appreciated.
    Thanks
    Alex

    Good Morning Vetsrini,
    I know that the "Report Formatting Time Zone" is used to set the timezone properly INSIDE the report...but my attention now is concentrated on the Scheduling...
    As I mentioned before I'd like to find a way to syncronize the BIP timezone (based on GMT) and my local server timezone (Athens, GMT+2), and this I think it's possiblie only if I can modify the BIP timezone (GMT): instead to have GMT, I'd like to have GMT+2 in order to have the same time in both of systems.
    I already tried to change the variable <xsl:param name="_XDOTIMEZONE">GMT</xsl:param> into the tmpl.xsl, but it didn't work....
    I don't understand how all the others millions of BIP users who don't live in UK can use the scheduler keeping in mind always the gap between their local time and the GMT time set in BIP......
    Do you have another hint or workaround ?
    Thanks for your help
    Alex

  • IPlanet Calendar Server 5.0 WCAP commands fetchcomponents_by_range,fetchevents_by_id,fetchtodos_by_id returns the event dtstart & dtend in GMT and not in the timezone (tzid) specified in the command

    hi,
    i am vinod from knowledge systems pvt ltd. we are the partners with the iplanet india for customer support.
    problem description :
    m fetchcomponents_by_range,m fetchevents_by_id,m fetchtodos_by_id returns the event dtstart & dtend in GMT and not the timezone (tzid) requested
    i have an development issue with the iplanet calendar server 5.x.if i execute WCAP command storeevents.wcap as follows for storing an event
    http://localhost:portnumber/storeevents.wcap?id=n38tew98wbhhv95s&calid=userA&tzid=America/Indianapolis&rid=0&dtstart=20020419T050000Z&duration=PT1H0M&summary=eventtest&fmt-out=text/xml
    in the calendar server the dtstart and the dtend for this event is as follows
    dtStart = 1019210400 (20020419T100000Z) [19-Apr-02 10:00AM GMT] (isDate = 0)
    dtEnd = 1019214000 (20020419T110000Z) [19-Apr-02 11:00AM GMT] (isDate = 0)
    NOTE : in the WCAP command i had specified the time in America/Indianapolis i,e 0500 hrs behind GMT(-0500) hence the server stores the dtstart & dtend in the GMT which is perfect as explained in the docs.
    Now for retreving the same event i execute the following command
    http://localhost:portnumber/fetchcomponents_by_range.wcap?id=n38tew98wbhhv95s&rid=0&calid=vt&tzid=America/Indianapolis&fmt-out=text/xml
    the result has the event details but the dtstart & dtend are in GMT and not in the America/Indianapolis timezone requested.
    <START>20020419T100000Z</START>
    <END>20020419T110000Z</END>
    NOTE : the Mime type requested in the WCAP is text/xml. the expected dtstart is 20020419T050000Z and dtend is 20020419T060000Z applied to the timezone specified in the tzid parameter(America/Indianapolis)
    issue :
    m fetchcomponents_by_range,m fetchevents_by_id,m fetchtodos_by_id returns the event dtstart & dtend in GMT and not the timezone (tzid) requested
    docs says the following which is not true for retrieving the events.....
    For example, if a command such as storeevents or fetchcomponents_by_range
    specifies a tzid parameter, the parameter value must be a tzid that is defined in the list of 91 time zones. The server will return data in that time zone and all data will have dates applied to that time zone.If the command specifies an unrecognized tzid, the server will return a GMT timezone by default. All data returned on that command will have its dates applied in GMT.
    release notes has the following. i could not understand the point no. 1 could u please suggest me how to retrieve the event with dtstart & dtend values applied to the timezone supplied in the parameter tzid.
    1. The following seven commands now take an additional parameter, tzid:
    m deleteevents_by_id
    m deletetodos_by_id
    m fetchcomponents_by_alarmrange
    m fetchcomponents_by_lastmod
    m fetchcomponents_by_range
    m fetchevents_by_id
    m fetchtodos_by_id
    The value of tzid must be a time zone ID string, such as &#8220;America/Los_Angeles&#8221;. Note that these are not localized. If other ISO 8601 DateTime string parameters, such as rid, dtstart and dtend, do not have a &#8220;Z&#8221; on the end, this parameter determines the time zone to use.
    2. The following two commands, which already have the tzid parameter, have been modified:
    m storeevents
    m storetodos
    The value is no longer a quoted string, but is now a time zone ID string to match the acceptable values for tzid in the seven commands listed above.The default value of the tzid parameter in all commands is the server's default time zone. This is a change for storeevents and storetodos.
    thanks
    vinod

    I have found the solution! I post how I managed in case someone else has the same issue.
    You have to go to "Settings" -> "Settings Editor".
    There, there is a "display" entry.
    When you open the tree, you can see both of your displays (in my case, LVDS1 and VGA1).
    Under VGA1 (the "extra" monitor), there is a "Position" entry. There, you need to set the "X" variable to the last pixel of the other display resolution.
    E.g.: if you principal display is a "1366x768", then the "X" value will be 1366.
    You can also play on the "Y" if your screens are not horizontally aligned, but 0 should be fine.
    I hope this helps :-)

  • DSO - What key fields and data fields in dso

    Hi experts,
    I need to create a dso in between the cube and 2 data sources(2lis_11_vaitm, 2lis_12_vcscl) to stage the data. My question is: what key fields and data fields to choose for the dso? is there a standard dso to copy? please explain in detail the model to set up, whether to connect both the ds's to dso and then to cube or one ds to dso and the other to the cube. more details will help.

    Check this for standard DSO:
    http://help.sap.com/saphelp_nw04/helpdata/en/43/fcdc387f34384f94c3227baf3837a8/content.htm
    Thanks...
    Shambhu

  • Reading MS Project column names and data on the fly from a selected View

    Hi guys,
    I have several views on my project file (MSPROJECT 2010) and I want to build a macro so that;
    1. User can select any view ( Views can have diffrent columns and the user may add new columns as well)
    2. User runs the Macro and all the coulmns along with the tasks displayed in the view will be written to a excel file. ( I don't want to build several macro's for each view, I'm thinking of a common method which would work for any selected view)
    The problem I'm facing is that how will i read the column names and data for a particular view on the fly without hard coding them inside the vba code ?
    The solution needs to work on a master schedule as well.
    Appreciate your feedback.

    Just to get you started the following code writes the field name and data for the active task to the Immediate window.
    Sub CopyData()
    Dim fld As TableField
    For Each fld In ActiveProject.TaskTables(ActiveProject.CurrentTable).TableFields
    If fld.Field >= 0 Then
    Debug.Print Application.FieldConstantToFieldName(fld.Field), ActiveCell.Task.GetField(fld.Field)
    End If
    Next fld
    End Sub
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • Pdf portfolio source file name and date in file details

    Is it possible to import the source file name and extension as well as the source file created date in the portfolio file details?  Need to document source to portfolio in working with 3rd parties that will only have the original source.  Need to document what was converted into pdf as not all files in a directory will successfully convert to pdf.  Sometimes need to convert 100's of files.  Manual entry is inefficient.  the file names and modified dates are displayed on the Combine Files dialog.  is there a way to capture the detail on that page?

    I don't need the detail of when the pdf was added to the portfolio.  I
    need know which dwg or jpg or word file was converted and the original
    created date of that file for control of information.
    That is impossible; sorry. For some *very specific* types of conversion to PDF the pdfx:SourceModified XMP tag will be set to show the last-modification date of the source file (for example DOCX files converted using MS Word), but there will never be a human-readable record of the source filename or its creation date unless you have manually added them as document XMP properties after conversion (this is what the "Custom Properties" dialog is for). To embed source data automatically would raise no end of privacy and security problems for customers, who most certainly do NOT want their recipients seeing details of internal documents.
    Without writing a plugin there's no access to the internal workflow of the Combine Files dialog, so you cannot use a script to read the names and dates of the files *before* conversion and store them automatically in the new PDF Portfolio's Fields array.

  • Who worked with ICS' Model 4896 GPIB? I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    I can not count the data from the module. Can prompt as it to make. It is desirable with examples (data read-out from the module and data transmission between channels. It is in advance grateful.

    Hello. Most of the engineers in developer exchange are more familiar
    with NI products. Contacting ICS for technical support is a better
    course of action.

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates.
    My requirement is :
    create table xxinv_item_pei_taginfo(item_id number,
    Organization_id number,
    item varchar2(4000),
    record_type varchar2(4000),
    record_value CLOB,
    State varchar2(4000));
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'USES','fever','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'HOW TO USE','one tablet daily','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'SIDE EFFECTS','XYZ','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'DRUG INTERACTION','ABC','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'OVERDOSE','Go and see doctor','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'NOTES','Take after meal','TX');
    select * from xxinv_item_pei_taginfo;
    Item id Org Id Item Record_type Record_value State
    493991     224     1265-D30     USES     fever     TX
    493991     224     1265-D30     HOW TO USE     one tablet daily     TX
    493991     224     1265-D30     SIDE EFFECTS     XYZ     TX
    493991     224     1265-D30     DRUG INTERACTION     ABC     TX
    493991     224     1265-D30     OVERDOSE      Go and see doctor     TX
    493991     224     1265-D30     NOTES     Take after meal     TX
    Above is my data
    I have to fetch the record_type from a lookup where I can have any of the record type, sometime USES, HOW TO USE, SIDE EFFECTS and sometimes some other set of record types
    In my report I have to get these record typpes as field name dynamically whichever is available in that lookup and record values against them.
    its a BI Publisher report.
    please suggest

    if you have data in db then you can create xml with needed structure
    and so you can create bip report
    do you have errors or .... ?

  • Diff B/w ABAP Dictionary and Data Dictionary

    What is the difference between ABAP Dictionary and Data Dictionary........

    Hi,
    Both are the same.
    Please check this online document perhaps it may help.
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCDWBDIC/BCDWBDIC.pdf
    Regards,
    Ferry Lianto

  • ICloud sync and data usage

    After upgrading my ATT iPhone 4 to iOS5, I thought I would try out iCloud. I read somewhere, that it only syncs when it is connected to a powersource, and maybe I read that wrong, but I interpret it to mean when I am connected to either a power outlet or my computer using the cable. In otherwords, it wouldn't sync while I was out and about, away from my wireless home network, using the 3G network.
    Is this not correct?
    Because 2 days ago I racked up 80 MB of my data plan (not iCloud storage) while I slept at home, where I have a wireless network. I found this out by getting a text warning from ATT the next day, that I was close to using up my alloted 200MB data usage. I checked out my account online, and sure enough the 80MB transferred in the middle of the night. I didn't notice the "documents and data" setting was turned on so it looks like my apps updated while my phone was in sleep mode. Is there anything else it could be? I have everything iCloud turned off now and wondering if there is something I should know about to avoid wasting my data usage?

    elko wrote:
    After upgrading my ATT iPhone 4 to iOS5, I thought I would try out iCloud. I read somewhere, that it only syncs when it is connected to a powersource, and maybe I read that wrong, but I interpret it to mean when I am connected to either a power outlet or my computer using the cable. In otherwords, it wouldn't sync while I was out and about, away from my wireless home network, using the 3G network.
    Is this not correct?
    Because 2 days ago I racked up 80 MB of my data plan (not iCloud storage) while I slept at home, where I have a wireless network. I found this out by getting a text warning from ATT the next day, that I was close to using up my alloted 200MB data usage. I checked out my account online, and sure enough the 80MB transferred in the middle of the night. I didn't notice the "documents and data" setting was turned on so it looks like my apps updated while my phone was in sleep mode. Is there anything else it could be? I have everything iCloud turned off now and wondering if there is something I should know about to avoid wasting my data usage?
    I think possibly you are thinking about wireless sync of iTunes. That can be set to happen when you connect to a charger etc, but that is not the same thing as you are descrbing with iCloud.

  • Loading MS Access Table and Data into Oracle

    Hi,
    I have few tables in MS Access. I want to create same layout of tables in Oracle and want to populate data from MS Access tables to Oracle tables.
    Please let me know if there is a way by which I can create tables and load data automatically (thru some option or script)?
    I have Oracle 10g database and its clients.
    Thanks in advance,
    Rajeev.

    You can use Oracle migration workbench
    Loading MS Access Table and Data into Oracle
    It´s very easy to use and good to import
    regards,
    Felipe

  • Question regarding roaming and data usage

    I am currently out of my main country of service, and as such I have a question regarding roaming and data usage.
    I am told that the airplane mode is sufficient from keeping the phone off from roaming, but does this apply to any background data usage for applications and such?
    If the phone is in airplane mode, are all use of the phone including wifi and application use through the wifi outside of all extra charges from roaming?

    Ann154 wrote:
    If you are getting charged to use the wifi, then it is possible.  Otherwise no
    Just to elaborate here, Ann154 is referring to access charges for wifi, which is nothing to do with Verizon, so if you are using it in a plane, hotel, an internet cafe etc that charges for Wifi rather than being free .   Verizon does not charge you (or indeed know about!) wifi usage, or any other usage that is not on their cellular network (such as using a foreign SIM for example in global phones)  So these charges, if any, will not show up on the verizon bill app.  Having it in airplane mode prevents all cellular data traffic so you should be fine

  • Infoset Join condition on Key feilds and data fields

    Hi Guys,
    I have a requirement to biuld the Info set with join conditon on two DSO's  the info objects which i am using in the JOin condition are defined as data fieds in one DSO and defined as key fields in another DSO, is it possible to define join condition on key fields and data fields.
    The two info objects are                
                           0AC_DOC_NO
                           0ITEM_NUM
    These two info objects are defined as  data fields in DSO :   0LIV_DS1   Invocie verificaion
                                                            key fields in DSO:    0FIAP_0o3 FI AP Line Item
    Please suggest me is it possible to define join the condtion on the data fields and key feilds.
    Thanks
    Best regards
    SG

    Hi
    yes you can create join, you will get any issue in reporting level.
    example: Say i want to create Info Set on 0MATERIAL and Sales DSO.
    In 0MATERIAL Info Object it is key filed, but in my DSO 0MATERIAL is data field.Still we can create
    Creation of join is dependent on fields common in your source objects.
    check out the below document
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/2f5aa43f-0c01-0010-a990-9641d3d4eef7?QuickLink=index&overridelayout=true
    Regards,
    Venkatesh
    Edited by: Venkateswarlu Nandimandalam on Sep 27, 2011 2:26 AM

  • Key fields and data fields in a DSO  ??

    i have a question regarding key fields and data fields in a Standard DSO...
    i am using 2 datasources to build a open sales report 2LIS_11_VASTH  and  2LIS_11_VASTI   i am pulling in data from these 2 data sources to a DSO and i am wondering what infoobjects should be in the key fields and data fields .....does this reflect back to table VBUK and VBUP tables and does the key field in the DSO have to be the key fields in VBUK and VBUP tables  ????  or what really should be included as key fields and data fields   ????  
    please help....

    If you look at the various SD tables, VBELN and POSNR are commonly used as the document number and document line item.
    For VBAP and VBUP, it's referring to the Sales Order Line Item with the columns VBELN and POSNR as the key for both tables. However, if you look at the LIPS table, which is the Delivery Line Item table, it too has VBELN and POSNR as the key. Likewise, the VTTP table, which is the Shipment Line Item table, also has VBELN and POSNR as the key.
    While using RSOSFIELDMAP as a map is a fairly good "rule of thumb", it still needs to be used with a level of skepticism.

Maybe you are looking for