I have a problem with Time...

Hi... my problem is that I need to compare two Times, but I don't know wath is wrong in my code... I read a Time from a String, I convert that String in Date, and I transfor this Date in Time, to compare with another Time... but It don't work...
My code is:    public long Valor_Minutos(long Minutos, long Ini, long Fin, int Mesa){
        Connection conec;
        Statement state;
        ResultSet rec;
        String Horas_1, Horas_2, Horas_3;
        int Valor_1, Valor_2, Valor_3;
        long Valor_Total;
        java.util.Date Fecha, Fecha_1_1, Fecha_1_2, Fecha_2_1, Fecha_2_2, Fecha_3_1, Fecha_3_2;
        java.sql.Time Hr_1_1, Hr_1_2, Hr_2_1, Hr_2_2, Hr_3_1, Hr_3_2, Hr_Ini, Hr_Fin;
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
        Fecha = new java.util.Date();
        Fecha.setTime(Ini);
        Hr_Ini = new java.sql.Time(Fecha.getTime());
        Fecha.setTime(Fin);
        Hr_Fin = new java.sql.Time(Fecha.getTime());
        Horas_1 = Horas_2 = Horas_3 = null;
        Valor_1 = Valor_2 = Valor_3 = 0;
        rec = null;
        Fecha_1_1 = Fecha_1_2 = Fecha_2_1 = Fecha_2_2 = Fecha_3_1 = Fecha_3_2 = null;
        Hr_1_1 = Hr_1_2 = Hr_2_1 = Hr_2_2 = Hr_3_1 = Hr_3_2 = new java.sql.Time(0);
        Horas_1 = "09:00 a 14:59"
        Horas_2 = "15:00 a 18:59"
        Horas_3 = "19:00 a 04:00"
        Valor_1 = 1200;
        Valor_2 = 1400;
        Valor_3 = 1600;
        try{
            Fecha_1_1 = sdf.parse(Horas_1.substring(0,5) + ":00");
            Hr_1_1.setTime(Fecha_1_1.getTime());
            Fecha_1_2 = sdf.parse(Horas_1.substring(8,13) + ":59");
            Hr_1_2.setTime(Fecha_1_2.getTime());
            Fecha_2_1 = sdf.parse(Horas_2.substring(0,5) + ":00");
            Hr_2_1.setTime(Fecha_2_1.getTime());
            Fecha_2_2 = sdf.parse(Horas_2.substring(8,13) + ":59");
            Hr_2_2.setTime(Fecha_2_2.getTime());
            Fecha_3_1 = sdf.parse(Horas_3.substring(0,5) + ":00");
            Hr_3_1.setTime(Fecha_3_1.getTime());
            Fecha_3_2 = sdf.parse(Horas_3.substring(8,13) + ":00");
            Hr_3_2.setTime(Fecha_3_2.getTime());
        }catch(ParseException pe){}
        Valor_Total = 0;
        long Aux = 0, Aux2 = 0;
        if (Hr_Ini.getTime() >= Hr_1_1.getTime() && Hr_Ini.getTime() <= Hr_1_2.getTime()){
            if (Hr_Fin.getTime() >= Hr_1_1.getTime() && Hr_Fin.getTime() <= Hr_1_2.getTime()){
                Valor_Total = (long)Math.ceil((double)Minutos * Math.ceil((double)Valor_1 / 60));
            else if (Hr_Fin.getTime() >= Hr_2_1.getTime() && Hr_Fin.getTime() <= Hr_2_2.getTime()){
                Aux = Hr_Fin.getTime() - Hr_2_1.getTime();
                Aux = Aux / 1000;
                Aux = Aux / 60;
                Valor_Total = (long)Math.ceil((double)(Minutos - Aux) * Math.ceil((double)Valor_1 / 60));
                Valor_Total = (long)Math.ceil((double)Valor_Total + ((double)Aux * Math.ceil((double)Valor_2 / 60)));
            else if (Hr_Fin.getTime() >= Hr_3_1.getTime() && Hr_Fin.getTime() <= Hr_3_2.getTime()){
                Aux2 = Hr_2_2.getTime() - Hr_2_1.getTime();
                Aux2 = Aux2 / 1000;
                Aux2 = Aux2 / 60;
                Valor_Total = (long)Math.ceil((double)Aux2 * Math.ceil((double)Valor_2 / 60));
                Aux = Hr_Fin.getTime() - Hr_3_1.getTime();
                Aux = Aux / 1000;
                Aux = Aux / 60;
                Valor_Total = (long)Math.ceil(((double)Minutos - (double)Aux - (double)Aux2) * Math.ceil((double)Valor_1 / 60));
                Valor_Total = (long)Math.ceil((double)Valor_Total + Math.ceil((double)Aux * Math.ceil((double)Valor_3 / 60)));
        else if (Hr_Ini.getTime() >= Hr_2_1.getTime() && Hr_Ini.getTime() <= Hr_2_2.getTime()){
            if (Hr_Fin.getTime() >= Hr_2_1.getTime() && Hr_Fin.getTime() <= Hr_2_2.getTime()){
                Valor_Total = (long)Math.ceil((double)Minutos * Math.ceil((double)((double)Valor_2 / 60)));
            else if (Hr_Fin.getTime() >= Hr_3_1.getTime() && Hr_Fin.getTime() <= Hr_3_2.getTime()){
                Aux = Hr_Fin.getTime() - Hr_3_1.getTime();
                Aux = Aux / 1000;
                Aux = Aux / 60;
                Valor_Total = (Minutos - Aux) * (Valor_2 / 60);
                Valor_Total = Valor_Total + (Aux * (Valor_3 / 60));
        else if (Hr_Ini.getTime() >= Hr_3_1.getTime() && Hr_Ini.getTime() <= Hr_3_2.getTime()){
            Valor_Total = (long)Math.ceil((double)Minutos * Math.ceil((double)((double)Valor_3 / 60)));
        return Valor_Total;
    }Please help me...
Regards...
Mensaje editado por:
MetalTux

Sorry... but I don't know where put it...
Please sorry me.... and tell me where I have to put this on....
Regards...

Similar Messages

  • Since I upgraded to 10.7.2 lion I have these problems with Time Capsule. What is the problem? thanks

    since I upgraded to 10.7.2 lion I have these problems with Time Capsule. What is the problem? thanks

    Unable to access disk image backup "/ Volumes / Time Capsule / iMac Admin. Sparsebundle" (error -1).
    Then?????

  • Problem with Time Dimension generating

    Hello, everybody.
    I have a problem with Time Dimension generating with the help of the Standard Wizard.
    1. I choose Dimensions -> New -> Using Time Wizard
    2. Set Name as "Time"
    3. On the next screen I choose ROLAP: Relational Storage
    4. On the next screen set Start year: 2003, Number of years: 3
    5. On the next screen choose all levels of the Normal Hierarchy
    On the 6-th step Wizard complete 60% of job and hang up doing nothing (buttons "Cancel" and "Help" is active).
    chapter "Create REL_TIME Dimension Using the TIME Dimension Wizard", step 1-6 of tutorial =(
    http://www.oracle.com/technology/obe/11gr1_owb/owb11g_update_getting_started_intro/lesson3/less3_relational.htm
    My system characteristics:
    Builder client 11.1.0.7.0, warehouse at local computer.
    can anybody give me any advice about this problem? =(
    thanks in advance.

    Had this issue been solved please?
    I have just come across the exact same problem and this post is the only one i managed to find which describes exactly what is happening to me.
    Thanks

  • HT1338 problems with time  machine and parallels desktop,  mac osx mountain lion 10.8

    have a good day, i have been problems with time  machine and parallels desktop, dont work in mac osx 10.8, i upgrate two mac´s (macbook air, imac), in the two machines shows problems, could you help me please.
    two machines have good ram memory (macbook air 11.1 2010 early , imac 2009 late).
    i am waiting for your help.
    thanks.
    Jesus.

    Take a look here:
    http://pondini.org/TM/Troubleshooting.html
    Specifically, you'll probably want to try item #A5 on that page, but there's a lot of other info there that may be useful.

  • Problem with Time Capsule after backup session

    I have a problem with Time Capsule after a backup session. Our two Macs (on Maverick) loose connection with the station and the only thing that seems to help is unplugging the Time Capsule  and starting it again! After the next backup session the same thing happens again. The Macs seem not to be able to hold on to the connection and continually loose it.  The iPhones and iPads that we have (4 units) are not affected - it is the Mac Mini and Mac Powerbook that experiences this problem!
    I would be grateful for your help!
    Thor

    This is standard Mac issues and has been a bug floating around since Lion.. it hits some people worse than others.. but once it starts it is awful hard to get rid of.
    Just to confirm the connection to internet is not a problem?? Just the hard disk drops out?
    I recommend you
    1. Reset the TC to factory.. and start over with all new names.. short, no spaces pure alphanumeric.
    TC name and wireless name/s should conform. By default the disk share name is data which is fine.
    2. Mavericks has changed over from using AFP to SMB for network filesharing.. why Apple why??
    This is unhelpful to say the least. Many many people are struggling with TC and being unable to mount the network drive.
    So do it manually and force it back to AFP.
    In Finder use top menu, Go, Connect to Server.
    Type AFP://TCname or TCIPaddress (it must be the network name of actual TC.. or its IP address)
    When the computer locates the resource it will ask for a password.. it is public by default.. supply your password or public and save it in the keychain.
    3. Delete the existing TM setup and start over.. See A4 here. http://pondini.org/TM/Troubleshooting.html
    I cannot promise this will fix it but should reduce the problem to now and then.. rather than every time TM needs to backup.

  • I have a problem with my itunes. I cannot transfer apps from the itunes to my iphone 4s. Any time I try to snyc itunes tells me "The iphone could not be synced because this computer is no longer authorized for purchased items that are on this iphone. HELP

    I have a problem with my itunes. I cannot transfer apps from the itunes to my iphone 4s. Any time I try to snyc itunes tells me "The iphone could not be synced because this computer is no longer authorized for purchased items that are on this iphone. To authorize this computer for items purchased from the itunes store, choose, Store > Authorize This Computer. But anytime I authorize it tells me you have authorized including this computer 2 out 5 computers. And if I try again the same story over and over again. But I have many apps on my itunes which I want to transfer. Please someone help me.

    Well Authorize the Computer...........

  • The mail application on my I-Mac dates all mail, whether sent or received, as 5th (of whatever month it is). The computer clock is working, so it's not that. And the time seems to be right. I have no problem with my MacBook. Can anyone help, please?

    The mail application on my I-Mac dates all emails, in or out, as 5th (of whatever month it is). It seems to get the time right.
    The computer clock is fine. I have no problem with my MacBook - just with the I-Mac. Any ideas, please?

    OK Vicky, good clues...
    See if this helps...
    Open Keychain Access in Utilities, use Keychain First Aid under the Keychain Menu item, then either check the Password under that item, change it, or delete it and start over. See if there are duplicates, should be one for Incoming & one for Outgoing.
    Resetting your keychain in Mac OS X...
    If Keychain First Aid finds an issue that it cannot repair, or if you do not know your keychain password, you may need to reset your keychain.
    http://support.apple.com/kb/TS1544

  • Back up problems with Time Machine since I have Mavericks

    Since I upgrade to Mavericks Time Machine is not able to back up my MacBookPro.
    Not only it is slow but it never ends.
    Each time it seems to reach the end of the back up 150 or 200 mb are added to the amount to be saved.
    Without end.
    Before Maevroicks I had Montain Lion and it was fine.
    With my iMac I have no probleme with Mavericks ????

    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Enter the word "Starting" (without the quotes) in the String Matching text field. You should now see log messages with the words "Starting * backup," where * represents any of the words "automatic," "manual," or "standard." Note the timestamp of the last such message that corresponds to an abnormal backup. Now
    CLEAR THE WORD "Starting" FROM THE TEXT FIELD
    so that all messages are showning, and scroll back in the log to the time you noted. Select the messages timestamped from then until the end of the backup, or the end of the log if that's not clear. Copy them to the Clipboard by pressing the key combination command-C. Paste (command-V) into a reply to this message.
    If all you see are messages that contain the word "Starting," you didn't clear the text field.
    If there are runs of repeated messages, post only one example of each. Don't post many repetitions of the same message.
    When posting a log extract, be selective. Don't post more than is requested.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Some personal information, such as the names of your files, may be included — anonymize before posting.

  • Hi, I have the following problem with Time Capsule: La imagen del disco de copia de seguridad "/Volumes/Data/MacBook Pro de Carlos.sparsebundle" ya está en uso. Please your comments to solve this problem, i can't made a backup. Thanks.

    Hi, I have the following problem with Time Capsule: La imagen del disco de copia de seguridad “/Volumes/Data/MacBook Pro de Carlos.sparsebundle” ya está en uso. Please your comments to solve this problem, i can't made a backup. Thanks.

    Try Here  >  http://pondini.org/TM/Time_Capsule.html
    Perhaps P 2  >  Time Machine could not complete . . . sparsebundle could not be accessed. (Error 109).

  • I have a problem with face time

    I have a problem with face time as the mobile is sending messages to a no in UK which is 00447786205094 and this charges me a lot and I notice that it is sending this message to activate face time

    That's what happens when you buy an iPhone intended for a different market. If you want to avoid this, sell it and buy a phone intended for your market.

  • The last time you opened OpenOffice, it unexpectedly quit while reopening windows. Do you want to try to reopen its windows again? i have a problem with open office, if I press reopen, nothing happened  ans i see always this information on my mac? what ca

    The last time you opened OpenOffice, it unexpectedly quit while reopening windows. Do you want to try to reopen its windows again? i have a problem with open office, if I press reopen, nothing happened  ans i see always this information on my mac? what can I do?

    Please follow these directions to delete the Mail "sandbox" folders. In OS X 10.9 there are two sandboxes, while in 10.8 there is only one. If you're running a version older than 10.8, this comment isn't applicable.
    Back up all data.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Containers/com.apple.mail
    Right-click or control-click the highlighted line and select
    Services ▹ Reveal
    from the contextual menu.* A Finder window should open with a folder named "com.apple.mail" selected. If it does, move the selected folder — not just its contents — to the Desktop. Leave the Finder window open for now.
    Log out and log back in. Launch Mail and test. If the problem is resolved, you may have to recreate some of your Mail settings. You can then delete the folder you moved and close the Finder window. If you still have the problem, quit Mail again and put the folder back where it was, overwriting the one that may have been created in its place. Repeat with this line:
    ~/Library/Containers/com.apple.MailServiceAgent
    Caution: If you change any of the contents of the sandbox, but leave the folder itself in place, Mail may crash or not launch at all. Deleting the whole sandbox will cause it to be rebuilt automatically.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination  command-C. In the Finder, select
    Go ▹ Go to Folder...
    from the menu bar, paste into the box that opens (command-V). You won't see what you pasted because a line break is included. Press return.

  • I have a problem with iPhone is that I can replace it at points of sale in the U.S. because I bought from Saudi Arabia because the problem I think in the hard ware software worked more than 3 times did not fix

    dears,
    I have a problem with iPhone is that I can replace it at points of sale in the U.S. because I bought from Saudi Arabia because the problem I think in the hard ware I do resoftware more than 3 times did not fix.
    Network also always missing.
    I am living in KS Wichita. I hope you help me pleas.
    Regards.

    iPhone warranty is not international. You will have to return your
    iPhone to Saudi Arabia for repair/replacement. Either take it back
    yourself or send to friend/relative for them to take to Apple. Apple
    will not accept international shipments for repair nor will Apple
    ship repaired/replaced iPhones out of the country where the repair
    was done.

  • Update to Muse CC 2014.3 still have problem upload to FTP: Server not responding in time, FTP may not be supported on this server [Connection timed out after 15001 millseconds.] I have no problem with CC 2014. Can you suggest what do I have to do?

    Update to Muse CC 2014.3 still have problem upload to FTP: Server not responding in time, FTP may not be supported on this server [Connection timed out after 15001 millseconds.] I have no problem with CC 2014. Can you suggest what do I have to do?

    Hello.
    Today I got the opportunity to work with a Muse user with the same issue after performing the troubleshooting steps in the post above we decided to contact the host.
    Later i came to know that host took Muse user's IP and they were able to unblock it and muse started connecting to FTP host.
    I another scenario Host suggested Muse user to add :21 to the FTP address and then Muse was able to connect.
    Eg    ftp.domain.com:21
    Please try the 2 suggestion above and let me know if it works.
    Regards
    Vivek

  • I have a problem with elements 8. When ever I start a new project, the program searches for the old, latest used filmmaterial, I have used before. That means, if I use a different DVD, it take so much time, until the program starts. So how can I stopp the

    I have a problem with elements 8. When ever I start a new project, the program searches for the old, latest used filmmaterial, I have used before. That means, if I use a different DVD, it take so much time, until the program starts. So how can I stopp the automatically uploading of old material?
    Thanks

    You have 2 unreachable statements in this method.
    public static int eval(String s2, String op, String s3) {
    return lookup(s2);
    return lookup(op);
    return lookup(s3);
    } You're missing a } at the end of this method:
    public static int lookup(String s) {
        for(int k = 0; k < symbols.length; k++){
            String symbol = symbols[k];
            if(s.equals(symbol))
                return k;
        }You have some loose } and ; at the end of the file:
    public static void main(String args[])
    commandline();
    }

  • I have a problem with Adobe Creative Cluod. Basically after installing the application when I open it I do not charge adobe products but remains all white screen. I tried to uninstall it and install it several times but it does not work.  What should I do

    I have a problem with Adobe Creative Cluod. Basically after installing the application when I open it I do not charge adobe products but remains all white screen. I tried to uninstall it and install it several times but it does not work.
    What should I do?

    Hi Anto2211,
    Please follow the thread: Black screen CC where this issue is already discussed and resolved.
    Let me know for any further query.
    Thanks,
    Ratandeep Arora

Maybe you are looking for