Calculate Date/Time based on TimeZone

Hi guys,
what i want to do is the following:
given a database table tzdata composed of time zone names and tz offset
like this :
tzName tzOffset summer time used
Afghanistan ,+4.5, no
Albania ,+1, yes
Algeria, +1, yes
American Samoa,-11, no
i want to be able to display the corresponding Date / Time of each country based on the time zone offset .
I'm using a SimpleDateFormat , and want to know how to calulate time for each entry in table above.
thanks for helping !

given a database table tzdata composed of time zone names and tz offset
i want to be able to display the corresponding Date / Time of each country
based on the time zone offset .
in the offsets i posted above i found things like +10.5 ,-1.2 ect..
how to convert those into the correct format so i can feed it to SimpleTimeZone() construtor ?Why would you want to?
I am just pointing out here that java already has all those timezones and offsets configured into it. As well as if/when DST applies.
String[] zones = TimeZone.getAvailableIDs();
        for (int i=0; i<zones.length; i++){
          System.out.println("Zone " + i + " = " + zones[i] + " offset = " + TimeZone.getTimeZone(zones).getRawOffset());
In other words this database table is reinventing the wheel.
You just need to tell Java which Timezone you want (according to the standard names for timezones begin Region/City) and it will work out the correct offset.
eg
for Afghanistan: new TimeZone("Asia/Kabul");
Albania: new TimeZone("Europe/Tirane");
Cheers,
evnafets

Similar Messages

  • Calculate local time based on timezone offset

    I am sure this question has been answered many times. but if you can explain me how to calculate local time based on the timezone offset.
    for instance, I am in central time zone. but i want to display local pacific time on my page. I have the timezone offset as -420 minutes.
    Thanks in advance.
    KM

    given a database table tzdata composed of time zone names and tz offset
    i want to be able to display the corresponding Date / Time of each country
    based on the time zone offset .
    in the offsets i posted above i found things like +10.5 ,-1.2 ect..
    how to convert those into the correct format so i can feed it to SimpleTimeZone() construtor ?Why would you want to?
    I am just pointing out here that java already has all those timezones and offsets configured into it. As well as if/when DST applies.
    String[] zones = TimeZone.getAvailableIDs();
            for (int i=0; i<zones.length; i++){
              System.out.println("Zone " + i + " = " + zones[i] + " offset = " + TimeZone.getTimeZone(zones).getRawOffset());
    In other words this database table is reinventing the wheel.
    You just need to tell Java which Timezone you want (according to the standard names for timezones begin Region/City) and it will work out the correct offset.
    eg
    for Afghanistan: new TimeZone("Asia/Kabul");
    Albania: new TimeZone("Europe/Tirane");
    Cheers,
    evnafets

  • Error in computing time based on TimeZones on a server

    I have a piece of code that generates timestamps based on US TimeZones such as Pacific, Central and Eastern. I get correct results when I run this code locally (EST) but get results an hour off when I run the same code on a server running in US central time. See the results below and the code that I run.
    Results from running the code on Dev Server:
    ts: 2007-11-05 10:39:03.19 ���� ������� (Default time)
    tsEST: 2007-11-05 10:39:03.019� ������� (EST based on TimeZone String America/New_York, should be 11:39)
    tsCST: 2007-11-05 09:39:03.019� ������� (Central time based on TimeZone String US/Central, should be 10:39)
    tsPST: 2007-11-05 07:39:03.019� ������� (Pacific time based on TimeZone String America/Los_Angeles, should be 8:39)
    Results from running the same code on Local machine:
    tsEST: 2007-11-05 11:39:01.272� (Eastern Time based on TimeZone String America/New_York)
    tsCST: 2007-11-05 10:39:01.272� (Central time based on TimeZone String US/Central)
    tsPST: 2007-11-05 08:39:01.272� (Pacific time based on TimeZone String America/Los_Angeles)
    Below is the code that I ran.
         Timestamp ts = new Timestamp(Calendar.getInstance().getTime().getTime());
    DateFormat df1 = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SS" );
    GregorianCalendar cal1 = new GregorianCalendar();
    Timestamp tsNow = new Timestamp(cal1.getTimeInMillis());
    TimeZone tsEST = TimeZone.getTimeZone("America/New_York");
    String inPattern = "yyyy-MM-dd HH:mm:ss.SS";
    DateFormat df = new SimpleDateFormat(inPattern);
    df.setTimeZone(tsEST);
    Date date = df.parse(tsNow.toString());
    df.setTimeZone(tsEST);
    ts = new Timestamp( df1.parse( df.format(date) ).getTime() );
    System.out.println("tsEST: " + ts.toString());
    DateFormat df2 = new SimpleDateFormat(inPattern);
    TimeZone tsCST = TimeZone.getTimeZone("US/Central");
    df2.setTimeZone(tsCST);
    ts = new Timestamp( df1.parse( df2.format(date) ).getTime() );
    System.out.println("tsCST: " + ts.toString());
    TimeZone tsPST = TimeZone.getTimeZone("America/Los_Angeles");
    df.setTimeZone(tsPST);
    ts = new Timestamp( df1.parse( df.format(date) ).getTime() );
    System.out.println("tsPST: " + ts.toString());

    Actually, I did try a complete removal and re-install with the same results. On the desktop machine on which the Ctime client is working, Ctime was installed on an earlier system version and was working before the upgrade to the current system. The client continued to work. This at least indicates an initial setup problem on 10.2.4 and may indeed relate to the product not yet being ready for the latest system.

  • Calculate Date/Time Difference in a Calculated Column Omitting Weekends, Holidays and Non-Working Hours

    I am looking for a formula to use in a calculated column that calculates the difference between two date/time fields while excluding weekends, holidays and non-working hours
    6/1/2010 9:43 AM - 6/7/2010 1:45 PM
    Here is the closest that I have gotten; however, this formula gives me a result of 96:
    =IF(AND((WEEKDAY([Resolved Date],2))<(WEEKDAY(Created,2)),((WEEKDAY(Created,2))-(WEEKDAY([Resolved Date],2)))>1),(((DATEDIF(Created,[Resolved Date],"D")))-(FLOOR((DATEDIF(Created,[Resolved Date],"D")+1)/7,1))-3),(((DATEDIF(Created,[Resolved Date],"D")))-(FLOOR((DATEDIF(Created,[Resolved
    Date],"D")+1)/7,1)*2))*24)
    Any and all assistance is greatly appreciated!

    I don't know how to exclude holidays but i exclude weekends(Sat&Sun)-
    IF(ISERROR(DATEDIF([Start Date],[End Date],”d”)),””,(DATEDIF([Start Date],[End Date],”d”))+1-INT(DATEDIF([Start Date],[End Date],”d”)/7)*2-IF((WEEKDAY([End Date])-WEEKDAY([Start
    Date]))<0,2,0)-IF(OR(AND(WEEKDAY([End Date])=7,WEEKDAY([Start Date])=7),AND(WEEKDAY([End Date])=1,WEEKDAY([Start Date])=1)),1,0)-IF(AND(WEEKDAY([Start Date])=1,(WEEKDAY([End Date])-WEEKDAY([Start Date]))>0),1,0)-IF(AND(NOT(WEEKDAY([Start Date])=7),WEEKDAY([End
    Date])=7),1,0))
    -Thanks
    Swapnil

  • How to calculate elapsed time based on user input

    I'm not sure what to do next in this program. Basically, I'm not sure exactly how to get the time to output accurately, as in what forumla I should be using.
    This is the question:
    What comes 13 hours after 4 o'clock? Create an ElaspedTimeCalculator application that prompts the user for a starting hour, whether it is am or pm, and the number of elapsed hours. The application then displays the time after that many hours have passed. Application output should look similar to:
    Enter the starting hour: 7
    Enter am or pm: pm
    Enter the number of elapsed hours: 10
    The time is: 5:00 amHere's the code I have so far:
    import java.util.Scanner;
    public class ElapsedTimeCalculator
         public static void main(String[] args)
              int starting_hour;
              int starting_minutes; /*This is added in case the user wants to add minutes as well.*/
              String am_or_pm;
              int elapsed_hours;
              int elasped_minutes;
              int time_hours;
              int time_minutes;
              System.out.println("Welcome. This application will give you the time based on your input.");
              System.out.println(" ");
              Scanner input = new Scanner(System.in);
              System.out.print("Enter the starting hour: ");
              starting_hour = input.nextDouble();
              System.out.print("Enter the starting minutes: ");
              starting_minutes = input.nextDouble();
              System.out.print("Enter either 'am' or pm': ");
              am_or_pm = input.nextString();
              System.out.print("Enter the number of elapsed hours: ");
              elapsed_hours = input.nextDouble();
              input.close();
              time_hours =
              time_minutes = 
              if(am_or_pm = "am" || am_or_pm = "a.m." || am_or_pm = "AM" || am_or_pm = "A.M.")
                   System.out.println("The time is " + time_hours + ":" + time_minutes + "am");
              if(am_or_pm = "pm" || am_or_pm = "p.m." || am_or_pm = "PM" || am_or_pm = "P.M.")
                   System.out.println("The time is " + time_hours + ":" + time_minutes + "pm");
    }To calculate time_hours should I just calculate this by adding the elapsed hour to the starting hour? I doubt it will be accurate for all situations.
    Same for the time_minutes For example, if the starting minutes and the elapsed minutes were 50, it would be greater than 60. Also, not sure if it makes sense to separate hours and minutes like this, it's not required to in the question. I initally thought it would be easier to approach like this instead of allowing the user to input a double for the starting hour. ex. 5.7
    I get the feeling that this is extremely simple, but nonetheless, I'm stuck, so any help would be appreciated.

    Well thanks to both of you. I did a little reading up on the modulus operator and coupled it with some logic (although, truthfully, I'm not really using to there actually being an application for the remainder of a division operation, since it's never really used very much in any of my Math courses) and the hours portion works perfectly now:
    import java.util.Scanner;
    public class ElapsedTimeCalculator
         public static void main(String[] args)
              int starting_hour;
              //int starting_minutes; /*This is added in case the user wants to add minutes as well.*/
              String am_or_pm;
              int elapsed_hours;
              //int elasped_minutes;
              System.out.println("Welcome. This application will give you the time based on your input.");
              System.out.println(" ");
              Scanner input = new Scanner(System.in);
              System.out.print("Enter the starting hour: ");
              starting_hour = input.nextInt();
              //System.out.print("Enter the starting minutes: ");
              //starting_minutes = input.nextInt();
              System.out.print("Enter either 'am' or pm': ");
              am_or_pm = input.next();
              System.out.print("Enter the number of elapsed hours: ");
              elapsed_hours = input.nextInt();
              input.close();
              int time_hours = 0;
              //int time_minutes;
              String meridien;
              if(am_or_pm.equals("am"))
                   time_hours = (starting_hour + elapsed_hours) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("am"))
                   time_hours = (starting_hour + elapsed_hours) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("AM"))
                   time_hours = (starting_hour + elapsed_hours) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("A.M."))
                   time_hours = (starting_hour + elapsed_hours) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("pm"))
                   time_hours = (starting_hour + elapsed_hours + 12) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("p.m."))
                   time_hours = (starting_hour + elapsed_hours + 12) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("PM"))
                   time_hours = (starting_hour + elapsed_hours + 12) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              else if(am_or_pm.equals("P.M."))
                   time_hours = (starting_hour + elapsed_hours + 12) % 24;
                   //time_minutes = (starting_minutes + elapsed_minutes) % 60;
              if(time_hours < 12)
                   meridien = "A.M.";
                   System.out.println("The time is: " + time_hours + ":00 " + meridien);
              else if(time_hours > 12)
                   meridien = "P.M.";
                   System.out.println("The time is: " + time_hours + ":00 " + meridien);
    }Now the only thing is the minutes. My teacher did say she wants the user to have the option to input minutes also if he/she desires, so I do need it. However, the only problem is that if say the user inputs a "starting minute" of 14 for example, and 66 minutes elapsing, then (14 + 66) int/ 60 = 1r20 but using the modulus operator would only give me 20. So how will I be able to add any extra hours if it is necessary?

  • Basic and scheduling  dates & time calculation in process order creation

    Hi guru's,
    i have one requirement, i need to calculate and display the basic and scheduled dates & times based on the given input i.e material , plant , process order type , quantity , UOM and scheduling type ( for corresponding scheduling type user will provide either start date or finish date ) using RFC. can  u plz provide any function module for this purpose or logic for calculating the same  , as i am working on version 4.7ee .
    Awaiting for a quick response.
    Regards,
    Madan

    Dear Rohan,
    1.Check the length of break timings defined in the resource that is assigned in the phase.
    2.Check in OPUZ whether for the process order type and plant combination whether scheduling is to include the break time also
    (whether the check box for scheduling with breaks) is included.
    Check and revert back.
    Regards
    Mangalraj.S

  • Date Time Zone Issue

    Hi,
    I am currently integrating Salesforce with ERPLN data via Informatica Cloud ETL.
    The client is on ERPLN 6.1, Fp3, and Oracle 10 database and AIX OS. Both the LN Application and Oracle database are on the same Timezone GMT +1.00.
    We observed that for Sales/Service Order dates, on Application front and on actual oracle database the date shown are different. There is a difference of either 1 hour or 2 hours, based on the day light savings in Europe.
    Because of this difference, there is invariable changes in dates as well. For eg. Service Order date shown on ERPLN Application is 01-Jan-2013 00.12.25, but for the same service order the date stored in oracle database is 31-Dec-2012 23.12.25. Difference of 1 hour results in change of date as well. The difference doesnt remain the same over period, since there is day light savings as well.
    So when we pull this data via ODBC connectivity in to Staging Database through Informatica cloud, the date shown is that of Oracle Database. When we push this date in to Salesforce, we want the dates shown same as that of ERPLN application.
    Has anyone encountered such problems before, if yes, than what is the resolution for the same? I understand we change the TimeZone of the ODBC user, but that isnt possible or it doesnt help.
    Appreciate your quick reply. Thanks much.
    Warm Regards,
    Raviraj Raikar

    >
    I am currently integrating Salesforce with ERPLN data via Informatica Cloud ETL.
    The client is on ERPLN 6.1, Fp3, and Oracle 10 database and AIX OS. Both the LN Application and Oracle database are on the same Timezone GMT +1.00.
    We observed that for Sales/Service Order dates, on Application front and on actual oracle database the date shown are different. There is a difference of either 1 hour or 2 hours, based on the day light savings in Europe.
    Because of this difference, there is invariable changes in dates as well. For eg. Service Order date shown on ERPLN Application is 01-Jan-2013 00.12.25, but for the same service order the date stored in oracle database is 31-Dec-2012 23.12.25. Difference of 1 hour results in change of date as well. The difference doesnt remain the same over period, since there is day light savings as well.
    So when we pull this data via ODBC connectivity in to Staging Database through Informatica cloud, the date shown is that of Oracle Database. When we push this date in to Salesforce, we want the dates shown same as that of ERPLN application.
    Has anyone encountered such problems before, if yes, than what is the resolution for the same? I understand we change the TimeZone of the ODBC user, but that isnt possible or it doesnt help.
    >
    Sure - that problem is encountered whenever an application accepts user input that includes date/time but no timezone information. The timezone is often the client timezone; that is, the timezone of the user entering the data. Users in two different timezones entering the same date/time at exactly the same moment may find the data value stored is an hour or two different depending on the timezone of the DB server.
    Yep! What happens if you ask a friend in a different timezone to call you at 3 pm? Which timezone are you talking about? Theirs or yours? Without knowing that you can't guarantee that you get the call when you think you will.
    So you already know the possible solutions: 1) you need to capture the timezone with the date/time or 2) you need to ALWAYS use the same timezone (e.g. the server timezone).
    You will need to change the app to implement one of those solutions or change the back-end to determine the timezone of the user provding the data and convert it.

  • Batch Change Date/Time - same time to full batch, not offset timing?

    Is there a way to force Aperture to change the date/time on a batch of photos with ALL images to the same exact date/time?
    Right now, I have a bunch of scanned images with the wrong date/time, but of course, scanned at different times (embedded image date/time). When using Aperture 2.1's "Metadata", "Adjust Date and Time..." function, I only have one image with the input desired date/time, then all the other scans have a different date/time based on the timing offset difference from the scanning, which over the course of several scans changes by several days quickly.
    Does anyone know of a work around? I'd hate to manually adjust hundreds/thousands of image metadata by hand when Aperture should do this easily.
    Thanks!!

    Correct, I am referring to the EXIF data. Aperture can change this data using the aforementioned "Metadata", "Adjust Date and Time..." feature, it's only that Aperture can't (as far as I can tell) set a batch of photo to the exact date and time among the entire batch.
    Perhaps I'll be able to find or create an Apple Script to do this outside of Aperture?
    It's a shame though as I can't possibly be the only one with a large scanned collection from years ago I'm trying to archive in proper date order. This would be a great new added feature Apple, if you are also reading this! (I've already submitted the feature request some weeks ago)

  • How to calculate period between date/time?

    All,
    I have not been able to find any function module that does this.
    I have a create date/time from a table (VBAK).
    I need to calculate the difference in days/hours/minutes (seconds not needed) between the date in this table and the current date/time.
    Then based on the result - e.g. difference is say 2 days 3 hours and 50 minutes - I will compare to a comfigured period users input to determine record selection.
    I can get date difference - SAP handles that - but the hours and minutes are a different story.
    Thanks.
    Scott

    No Matters if problem solved by own. Surely Posting a solution would help others needed person in future .

  • How do you calculate difference in time (hours and minutes) between 2 two date/time fields?

    Have trouble creating formula using FormCalc that will calculate difference in time (hours and minutes) from a Start Date/Time field and End Date/Time field. 
    I am using to automatically calculate total time in hours and minutes only of an equipment outage based on a user entered start date and time and end date and time. 
    For example a user enters start date/time of an equipment outage as 14-Oct-12 08:12 AM and then enters an end date/time of the outage of 15-Oct-12 01:48 PM.  I need a return that automatically calculates total time in hours and minutes of the equipment outage.
    Thanks Chris

    Hi,
    In JavaScript you could do something like;
    var DateTimeRegex = /(\d\d\d\d)-(\d\d)-(\d\d)T(\d\d):(\d\d)/;
    var d1 = DateTimeRegex.exec(DateTimeField1.rawValue);
    if (d1 !== null)
        var fromDate = new Date(d1[1], d1[2]-1, d1[3], d1[4], d1[5]);
    var d2 = DateTimeRegex.exec(DateTimeField2.rawValue);
    if (d2 !== null)
        var toDate = new Date(d2[1], d2[2]-1, d2[3], d2[4], d2[5]);
    const millisecondsPerMinute = 1000 * 60;
    const millisecondsPerHour = millisecondsPerMinute * 60;
    const millisecondsPerDay = millisecondsPerHour * 24;
    var interval = toDate.getTime() - fromDate.getTime();
    var days = Math.floor(interval / millisecondsPerDay );
    interval = interval - (days * millisecondsPerDay );
    var hours = Math.floor(interval / millisecondsPerHour );
    interval = interval - (hours * millisecondsPerHour );
    var minutes = Math.floor(interval / millisecondsPerMinute );
    console.println(days + " days, " + hours + " hours, " + minutes + " minutes");
    This assumes that the values in DateTimeField1 and DateTimeField2 are valid, which means the rawValue will be in a format like 2009-03-15T18:15
    Regards
    Bruce

  • SPC charts for time-based data?

    I'll try to be succinct in explaining what I'm trying to achieve.
    We run batch processes, and at various points in the process we take samples and test them. The sample results should be increasing exponentially over the course of the batch. I have data from a lot of batches in x/y format - x is the duration of the batch and y is the sample result. It makes a very noisy but clearly exponentially increasing data set.
    What I want is to calculate some control limits that will obviously have to be increasing over time as well. I want to be able to say that, for a current batch, a sample at X time does or does not fall within the expected historical range.
    Is this even possible with xMII, either in the logic editor or the iSPC charts?
    I'd like to make the same sort of chart for other time-based samples that have more complex trends over the duration of a batch, not simply exponential or linear.

    Hi, Carrie.
    Your application doesn't really sound like what I would call an "SPC" chart, but rather, more of a so-called "golden batch" chart.  This type of visualization is used when a production activity should have an expected set of value(s) and/or a shape to a curve.  You would then "overlay" actual values onto this curve to track actual vs. expected and perhaps to highlight deviations.
    This can best be done by combining a multiple queries using BLS (one or more queries for the "limits" and expected values, one query for the actual values), and combining/merging them so that the charting engine (either a line/marker chart or an XY plot) sees them as coming from a single source.
    With some creativity, you can even have the "outlier" points displayed in another color.  The xMII application team can help you with setting this up - Jeremy may still have a chart template/transaction I put together a while back called "LimitChart", which could be used for your application.
    Rick

  • Aperture 3.2: renaming based on date/time doesn't work properly

    While importing I rename my photos based on the date/time they were taken.
    In Aperture 3.1.3 this worked perfectly fine; for photos taken within the same second Aperture added an index number for the second, third etc. photo automatically.
    In Aperture 3.2 this doesn't work any longer; Aperture simply doesn't import photo number 2, 3 etc. of that particular one second.
    Note: I store the original files outside the aperture library, all run under snow leopard on an iMac i7. And as I said this worked fine under 3.1.
    Does anyone have an idea?

    Thanks all for the response
    Leonie, here are the details of what I do/experience:
    a) Aperture message after import
    b) I import pairs and rename them as follows “IMG_{Image Date}_{Image_Time}” (I know all the disadvantages of this but old habits are hard to break… and for me it still works fine)
    c) Difference of the images that are imported / not imported is solely the hundredth of the second when they were taken. Of my test series only the first image has been imported:
    DSC_4903.jpg(2011/10/19 22:49:50.08)
    DSC_4904.jpg(2011/10/19 22:49:50.25)
    DSC_4905.jpg(2011/10/19 22:49:50.43)
    DSC_4906.jpg(2011/10/19 22:49:50.60)
    DSC_4907.jpg(2011/10/19 22:49:50.80)
    d) I import via the import panel: Import in new project – storefiles in particular folder (not Aperture library) – subfolder ‘imageyear/month” – rename as described above – import both
    Doug, after some trial and error I agree with your thoughts, Aperture apparently simply lost its automatic indexes ‘-1’, ‘-2’ etc. and – what is good - doesn’t overwrite the first with the second and the third image... As you suggest there are different options to make the images unique. Most simple would be to add {index #} or {sequence #} or {counter}, all would do and I probably will choose one of them. Or I will downgrade back to 3.1.3 (do have backups) and wait until Apple fixes this.
    Kirby, turnoff “Don’t import duplicates” was a good idea but didn’t solve it. But your naming convention actually ensures the uniqueness of the files.
    Michael

  • External content based SharePoint list date/time information wrong

    So, we have a SQL Server database that contains date/time type data.
    When we look at the info in the database, the date and times appear to be in GMT, which is 5 hours before our time.
    So, we set up views with a DATEADD calculation to compensate for the difference. When we use the view, the dates and times match our timezone info.
    We then set up an external content to our view.
    When the data is displayed in rows and columns, we see times that are 10 hours before GMT.
    We had put in the dateadd calculations because when we had scripts that grabbed the data from SQL Server and put them into text files, the dates and times were all 5 hours off.
    Is there code within the External data connectors (or SharePoint itself) which compensate for the time zones?
    Thanks!

    Hi Iwvirden,
    When you create an External Content Type and External List using the SharePoint Designer, DateTime fields are normalized to UTC using the NormalizeDateTimesetting
    associated with the TypeDescriptor for the DateTime field. This leads to the date field wrong in Business
    Connectivity Services.
    To fix this issue, you can change the normalization to use local time as follows:
    <TypeDescriptor TypeName="System.DateTime"
    Name="DueDate" DefaultDisplayName="Due Date">
    <Interpretation>
    <NormalizeDateTime LobDateTimeMode="Local" />
    </Interpretation>
    </TypeDescriptor>
    Here is a similar thread for your reference:
    Timestamp in Sharepoint external content type not matching value in SQL table
    Here is a detailed article for your reference:
    Why are my date fields wrong in Business Connectivity Services?
    Best Regards
    Zhengyu Guo
    TechNet Community Support

  • How to calculate Average time from a date field

    Hi All,
    I have a date type field in my table .
    I want to calculate average time for a given country in a select query. Date has to be exculded. Only time has to be taken into consideration.
    Kindly help me.
    Sample data
    india 25-JUN-09 08:12:45
    india 25-JUN-09 09:01:12

    Take which one you want.WITH dates AS
      (SELECT sysdate x FROM dual
        UNION
       SELECT sysdate + 1 +1/24 FROM dual
    SELECT TO_CHAR(to_date(AVG(to_number(TO_CHAR(to_date(TO_CHAR(x,'HH24:MI:SS'),'HH24:MI:SS'),'sssss'))),'sssss'),'hh24:mi:ss')
       FROM dates;
    WITH dates AS
      (SELECT sysdate x FROM dual
        UNION
       SELECT sysdate + 1 +1/24 FROM dual
    SELECT floor(24 * AVG(x- TRUNC(x)))
      || ':'
      || floor(mod(24 * AVG(x- TRUNC(x)),1) * 60)
      || ':'
      || floor(mod(mod(24 * AVG(x- TRUNC(x)),1) * 60,1) * 60)
       FROM dates;By
    Vamsi

  • Best way to manage date/time variables across different timezones

    I have an application that relies heavily on time accuracy. At the moment everything is fine, but soon the system will service customers across multiple timezones. The default behavior of the Date class is to show dates related to the current timezone, is there an easy way (setting) to override this behaviour? The system should show the time entered regardless of the timezone it was entered on.
    I use CF 8 for the back-end, and MySQL 5.1 to store data. The front-end is Flex 3/Air 2.
    I have looked everywhere, and things like saving dates as strings, or long ints, but if possible, I'd like to find a solution that does not involve dramatic changes to my database/code.

    Thanks for your reply, UbuntuPenguin,
    Your explanation is correct and what I'm trying to find out is an easy way to override that behaviour.
    As an example of what the issue is, let's say an event was entered here, in Toronto,ON, at 3pm, if a customer in Arizona sees the time, he/she will call us immediately to inform us that the event it's supposed to happen at 3pm, and not at 12pm (time that they see with the different timezone).
    As far as I've seen, the "best" way to approach this issue is by using  the transient tag during data transfer and compensate for the time  difference in the client timezone vs the selected "system" timezone  using getters/setters, but that implies storing the wrong date/time and  locking the system into one timezone, and it's just a hack that may  bring undesirable consequences in the future.

Maybe you are looking for

  • Payment usage on Display document

    Hello All, In company code 1000 and 2000, For a clearing document display using FB03, when i go to Environemnt-->Payment usage, it will show  me all the Documents which are cleared for the clearing document. In company code 3000, it is not the case.

  • My iphone backup on icloud is gone, I can only find my ipad backup

    Ok, so I have an old iphone 3GS, my daughter has an ipad mini. We are both using the same apple ID and it is causing me no end of grief. Most recently, my phone is currently doing a constant cycle between the boot screen and the lock screen. I have n

  • JAVA error - Running forms

    Hi, I have Database 8.05 and 8IAS. On client side while running the application i sometime get .MessangeManager.key CONFAIL bundle oracle.forms.engine.RunformBundle exception java lang.illegalArgumentException: unknown format type at .java Exception

  • Issue with Gmap or GPS

    Hi all, I've some problem, i think with a sencor of my Z3c. In fact, when i launch Gmap, Earth or any other apps using compas. I've a deviation of 45° between the real North and what appears on my screen. For my Z3c North is East. So i didn't find...

  • Stop print test page for HP Deskjet Ink Advantage 1515 All-in-One Printer

    How do I stop my HP Deskjet Ink Advantage 1515 All-in-One Printer from printing a test page every time I STARTED printing???? This question was solved. View Solution.