Example of Date comparison work not as expected...

First of all, sorry for the creation of another post.  Didn't know if I should of just added to a previous message (s) now that I have an example of comparison of date/time works do not as expected.

I understand that the calendar will use the time zone for the device.  My device is located to the EAST (-0500).

The following code works fine when the time is set to h, however, does not as expected when in AM...

java.util.Calendar d1 = java.util.Calendar.getInstance (); now
java.util.Calendar d2 = java.util.Calendar.getInstance (); now
                  
String date = ' 11/10/2011-05:05;
                  
yy int = 0, mm = 0, SD = 0, h = 0, e = 0;
                  
mm = Integer.parseInt (date.substring (0, 2)) - 1; January = 0
DD = Integer.parseInt (date.substring (3, 5));
YY = Integer.parseInt (date.substring (6, 10));
HR = Integer.parseInt (date.substring (11,13));
MI = Integer.parseInt (date.substring (14.16));

D2. Set (Calendar.YEAR, AA);
D2. Set (Calendar.MONTH, mm);
D2. Set (Calendar.DATE, dd);
D2. Set (Calendar.HOUR, human resources);
D2. Set (Calendar.MINUTE, mi);
D2. Set (Calendar.MILLISECOND, 0);
                  
String ampm = date.substring (17, 19);
If (ampm is 'AM')
{
D2. Set (Calendar.AM_PM, Calendar.AM);
}
on the other
{
D2. Set (Calendar.AM_PM, Calendar.PM);
}
                  
long t1 = d1.getTime () .getTime ();
long t2 = d2.getTime () .getTime ();

String strCurrentDate = new Date (t1) m:System.NET.SocketAddress.ToString ();
String strActivateDate = new Date (t2) m:System.NET.SocketAddress.ToString ();
                              
If (t1 > = t2)
Dialog.Inform ("current date of" + strCurrentDate + "is superior to activate date of" + strActivateDate);
If (t1<>
Dialog.Inform ("current date of" + strCurrentDate + "is less that activate date of" + strActivateDate);

The result of current date/time is fine, but the result for strActivateDate is returned as "Tue Oct 11 17:15:48 2011 America/New_York '.  Date is fine, however, is not time.  Time ends as PM (17:05).

Am I missing something obvious here?  Again, excuse me for the post, maybe should added on the previous post, but I think that this new post can be useful to others in the same situation.  Would appreciate any comments.  Thank you 1 million.

Karim

It's what I tell you is wrong and how to fix it.

http://StackOverflow.com/questions/513832/how-do-i-compare-strings-in-Java

In short: Do not compare with the help of is, use the equals() method.

Tags: BlackBerry Developers

Similar Questions

  • Type check in Business Checks check list doesn't work not as expected

    Details of the environment

    ======================

    Disqualification Version: 12.1.3.0.0


    I defined in trade controls reference data the following configuration:

    Define by test of name checking:

    Type checking: check list

    Option 1: MOVE


    After that, I created a rule in the rules of reference data in accordance with the following:

    Rule ID: tstrule

    Apply to attribute: attribut1

    Check 1: define by test

    In the business rule processor, I traced attribute1 with the STATUS column. The STATUS column contains only the value either a SUCCESS or FAILURE .

    I expect all records with a value of pass to be in the list of records passing because PASS equals the value defined in the list, check however all records are appearing in the list of failure in the processor business.

    My understanding is that if you create a check and then use it directly in the rule as long as the check is satisfied (PASS = PASS), it must go through the processor business rule.

    Please indicate why the records are in a failed State.

    Note: I tried surrounding the value of Option 1 with single quote and double quote, but I got the same result.

    Hi Jason,

    Tested this case and it worked fine.

    You have all white spaces in the data or something?

    Or do you have other rules in the cheque which fail to record? You can see which rules are incorrect in the output.

    Kind regards

    Mike

  • Linear in shape doesn't work not as expected?

    Hello

    I use the Fit.vi to NI_AALPro.lvlib:Linear on an array of vertically stacked points. However, the outcome makes absolutely no sense, the fitted line does not represent the input data.

    But if I rotate the points of 1 degree, adjustment seems to work...

    Why is this and is at - it a function or a way to properly adapt their orientation issues?

    Thanks in advance!

    I enclose:

    • The VI himself
    • A screenshot of the VI
    • The image of test (no rotation)
    • The test image (1 degree rotation)
    • A screenshot of the result of fitting (no rotation)
    • A screenshot of the result of fitting (1 degree rotation)


  • variable cluster shared doesn't work not as expected

    Hi all

    I use shared variables for communication between a computer host and target time real crio.  This works well as simple variables.  I configured a set of shared variables in an attempt to clean up the code a bit.

    I have some problems.  If I write to a single element, for help, the other elements of the cluster that I don't want to not write to are replaced with unknown default values.   Second, when the host program is stopped, the cluster on the host computer RT wrote what appears to be default values for all variables of the cluster on the RT.  The idea is to keep the RTW program running in its current state until the host computer retrieves.  Of course, this is impossible, if it resets all default data.

    It seems that I can only write to a cluster on one side and read on the other side.  I can't read/write in the same cluster at different points on the host machine and target.  With a shared variable, I can read/write to my hearts content on any process.  I could not find a way to solve this problem.

    I'll post the code, but you will need a cRIO to run it.  If someone uses the cluster shared variables, I'd be curious to see how you do.

    Thank you
    John

    That makes sense, I can think about is that you write on the same cluster in two different places. Each location will update the two values so if the host writes B1 = False and B2 = True then the Rio writes B1 = False and B2 = False, then the variable will be set to the most recent of the two being false. It's a loop condition.

    Even if you only set a value in the bundle name the another value from the cluster to a package of entry by name.

    To manage this, you'll need to remove the cluster to enter the bundle name and replace it with the shared variable read. This is where you need a time to make sure that the variable has the most recent value updated.

    Also, you still have the stress points. For the shared variable try linking to the custom control instead of an indefinite cluster (choice according to below in the setup of the SV)

  • HP T5730 XPe SP - 3 TeemTalk 7.0 Soft buttons doesn't work not as expected

    I am trying to program the soft keys in TeemTalk 7.0.  I built 'scripts', by using the build in tools.

    When I open a saved session keys are displayed as expected.  However by pressing one of the

    key does not execute the associated scripts. A sample script name is<'s:\hp-T5730\login.spt'>

    It I open the script editor and click on run it works?  Now, if I click the softkey, it works.

    Output and reruning TeemTalk 7.0 then opening the recorded session fills the softkeys as expected

    However by clicking on one of them does not run the script unless I am forst open in 'Tools', 'Script '.

    I am at a loss.

    Dave,

    Upgrade to 7.3.5 solved problems and I got a copy for Windows which works very well.

    Thanks for your help.

    Ken

  • Leak filter twelve months work not as expected

    Guys,

    All OOB reports come with trailing four quarters but if the quarter just started then the future months will have no data.

    If it's Q4 and a July, August and September - in August and September are in the future there is no data. so we see only 10 months.

    My req is if we're 15 - I want to see every month from 14

    I've implemented as the logic below but it is not work - these are filters

    Business period is superior to @{ENTERPRISE_PERIOD_YEAR_AGO}

    AND the company period is less than or equal to @{CURRENT_ENTERPRISE_PERIOD }

    I see the result is that a month, which is July 15 - can you guys please tell me where I am doing wrong - please check the attachment for the result

    Thank you

    1.JPG

    I got the 12 months I'm looking for but the sorting does not work properly - you guys can help pls

    I use this formula - 'Time Enterprise'. "" Date of the company "BETWEEN TIMESTAMPADD (SQL_TSI_MONTH-12, CURRENT_DATE) AND CURRENT_DATE

  • Bind 4 K doesn't work not as expected

    I started working more and more with 4K despite the material does not quite being height.

    We use CatDV on a 48 TB media server so that producers can annotate and select their clips. CatDV also creates proxies with the exact same file names that I can use for the first mounting with.

    When it comes to uprez, I take the offline sequence and choose bind again. I point the first proxy in the list on the clip of 4K and click OK. I would expect first auto add a link to the other items in the list to the new location/images but everything else in the list just goes back to be bound for the proxies. The only way I can get this process works as expected must temporarily rename the proxy folder, but which has the effect of disconnecting all sequences including bin clips.  So, after re-Binder the sequence to 4 K, I have to go out, rename the proxy folder to le nom d' origin and then go back and re - link all the clips of bin as well.

    This seems to be a very sloppy workflow.  Any suggestions out there on how to simplify?

    Lee

    Jim_Simon wrote:

    When PP is everything in the first folder, it will ask you for all other media not in this folder.  The project will not open until he found, or unless you have been told to keep that offline media.

    So if you see media offline after my listed operations, it may be only because you said PP to do.

    I don't know what you mean by 'bin clips.  All the clips are stored in lockers.

    Thanks for your suggestions.  I put a request for functionality with Adobe to explore the matter further.

  • Apply source formatting doesn't work not as expected

    Hello!

    I currently have a very simple problem, but it's annoying for me.

    The option 'Apply source format' has stopped working for me. I mean, it works, but not entirely.

    For example, I set my preferences for the tag "div" like this:

    before line breaks, inside, after. Content formatted and indented.

    But here is the result when I try to apply:

    < div id = 'page-wrapper' >

    < div class = "container-fluid" >

    < div class = "row" >

    < div class = "col-lg-12" >

    < h1 class = "page-header" > projects and customers < / h1 >

    < / div >

    < / div >

    < / div >

    < / div >

    It is really strange. It seems to work on half of the div only.

    Can someone help me with this?

    Thank you!

    It could just be a glitch of Friday the 13th.  For what it's worth, I created a keyboard shortcut to apply shaped Source (Ctrl + Q).  It saves time and I'm not click on the wrong item by mistake.

    Nancy O.

  • isLiteral function doesn't work not as expected

    We try to use "FILTER (isLiteral(?o))" to get all literal values for a variable particular sparql. It works for normal literal, but it does not work for CLOB values. If I have everything for the variable of the question, I get the following:

    O
    ORALL154

    O$ RDFVID
    6940262555896077121

    O$ _PREFIX
    ORALL154

    O$ _SUFFIX
    (null)

    O$ RDFVTYP
    TURNED ON

    O$ RDFCLOB
    (CLOB_VALUE)

    O$ RDFLTYP
    http://www.w3.org/2001/XMLSchema#string


    Given that the column "O$ RDFVTYP ' specifies 'BED' I assumed that this feature might work. The only option I see is to deny the Yaser function, but this can adversely affect performance. Are there other options?

    Thank you

    Hello

    This is the expected behavior. FILTER operations are not supported for long literals.

    Your idea to use the FILTER (! isURI(?o) &! isBlank(?o)) should give the expected results. Avoid a performance difference significant between the two approaches.

    Thank you
    Matt

  • Table 1 d of resizing doesn't work not as expected

    I try to resize a table 1dimensional in Teststand via AvtiveX using SetNumElements() with weight 0x00.

    The table is resized but its new size = OldSize + NewSize. EG: table has 3 elements and I resize to 5, there will be 8 elements in the end.

    How to resize and table?

    How to empty a table?

    I did the work somehow...

    I don't know how I got the resize to behave this way, but probably, I had one ignored! error in other substeps I used before SetNumElements.

    He now works as expected.

  • Backup Optimization doesn't work not as expected!

    Hello

    Oracle: 11.2.0.3

    O / s: OEL 5.4 32-bit

    Here's my configuration of RMAN

    rman.PNG

    So even if backup optimization is enabled, why every time I take runs a command 'backup database', as always backup all data files.

    This is a database of test on VM, kind of data aren't really change on all areas of storage.

    Not sure why RMAN is not jump data files while performing the backup?

    -Learner

    OPTIMIZATION will only jump data files that have absolutely no change since the last backup - that is to say reading only datafiles.

    Hemant K Collette

  • Port group deletion doesn't work not as expected

    I have a project where I have to rename all exchanges (create new VM to move, delete old) for our new naming convention.  I have a script which covers this. However, he has a problem with exchanges that follow the new standard with the exception of its case.  The script removes the exchanges on the hosts where the portgroup is empty!  Is there a way to get around this?  I even tried to rename the old portgroup but same problem here because she sees 2 exchanges regardless of case and fails to rename.

    Example: The z is lower among the ancient and new.

    OldPG: VM_169.036.072.000_24_0134_BaSz_Data

    NewPG: VM_169.036.072.000_24_0134_BaSZ_Data

    $targetClu = "Cluster001".

    $fileLocation = "h:\pgChangeInput.csv".

    Write-Host ""

    $getPG = import-Csv $fileLocation

    Write-Host "step 1: create the new portgroup (s) on $targetClu"-ForegroundColor Magenta

    {foreach ($line in $getPG)

    $Clu = $line. Cluster

    $OldPG = $line. OldPG

    $NewPG = $line. NewPG

    $Vlan = $line. VLanID

    $vSwitch = $line.vSwitch

    If ($Clu - eq $targetClu) {}

    Write-Host "processing = > $Clu, $OldPG, $NewPG, $Vlan, $vSwitch"-ForegroundColor green ""

    Write-Host "Creating portgroup $NewPG" - ForegroundColor yellow

    foreach ($esx in get-VMhost-location $targetClu | sort name) {}

    Write-Host "$esx" - ForegroundColor Cyan

    Get-VMHost $esx | Get-VirtualSwitch-name $vSwitch | New-VirtualPortGroup-name $NewPG - vlanid $Vlan | Out-Null

    }

    Write-Host "step 2: change the portgroup VM"-ForegroundColor Magenta

    Get-Cluster $targetClu | Get - VM | Get-NetworkAdapter | Where {$_.NetworkName - eq $OldPG} | Together-NetworkAdapter - NetworkName $NewPG - connected: $true - confirm: $false | Out-Null

    Write-Host "step 3: remove the old portgroup"-ForegroundColor Magenta

    foreach ($esx in get-VMhost-location $targetClu | sort name) {}

    Write-Host "$esx" - ForegroundColor Cyan

    Get-VMHost $esx | Get-VirtualSwitch-name $vSwitch | Get-VirtualPortGroup-name $OldPG | Delete-VirtualPortGroup-confirm: $false | Out-Null

    }

    }

    }

    Any help is greatly appreciated.

    You're right, the vSphere client seems to check the case of an existing portgroup, while the New VirtualPortgroup don't.

    The AddPortgroup method also seems to be case sensitive.

    I couldn't find anything on this in the Documentation Centre of vSphere, but in the book of vSphere Mastering of Scott Lowe, he also says that the names are case-sensitive.

    But it seems that PowerCLI is correctly using the name, which is case-sensitive.

    Back to the problem of you, you can use an operator that is case-sensitive in a Where clause to filter the desired portgroup.

    Something like that

    Get-VMHost $esx |
    Get-VirtualSwitch -Name $vSwitch |
    Get-VirtualPortGroup -name $OldPG |
    where {$_.Name -ceq $OldPG} | Remove-VirtualPortGroup -Confirm:$false | Out-Null
    

    Note that it uses the ceq- instead of the operator -eq .

  • URGENT... BUG in scrolling doesn't work not as expected when you use the navigation

    Hello

    I created this site for a client. He was literally works fine an hour ago. I just went to the post, and now when I use navigation, all my images, go to the left, even though I put them to fill.

    What could possibly get there? I'm supposed to show them this site tomorrow and now I can't. If you have any ideas, let me know.

    NOTE that this only happens when I use navigation. If I scroll it works. It is, however, very nervous.

    Home

    and here is the file:

    Dropbox - MicrositeRedesign02.zip

    Thank you

    Dave

    This behavior is caused by the white dots on the right side of the page master, forcing the content area (and thus the scroll in the browser area) is much wider than what you want.

  • dynamic links work not as expected

    Maybe I'm missing something.  I'm in cc2014 Prime Minister, I select one in and out of my calendar and choose "adobe dynamic link-> new after the composition of the effect.

    It opens with ae and made a model, but it's completely empty... and the length of the model is 30 seconds, but my inside and outside were far less important than

    This is my first attempt to do this, but I thought it was supposed to be simple enough.  Am I not understand how dynamic link is supposed to work?

    What you need to do is select all the clips or those you want on the timeline made a right click and select 'replace by AE composition', then it will take each of them in AE.

  • WkStation 7 - Snapshots doesn't work not as expected

    I am new to Workstation 7 and the ability to create multiple snapshots. In the end, I want to have a parent with more children - every child

    running a different version of MS Office.   However, in trying to do so, I am having instant strange behavior that left me speechless.  I googled and searched the forums and didn't have not seen anyone with a similar problem arise.

    I don't know what, if anything I am doing wrong.  I am running the latest version of Workstation 7 (7.0.1 Build 227600) on a host Windows 7 Ultimate.  Here's what happens:

    1. I created an installation fresh comments from XP Pro w / SP3 and all updates of Windows from May 22, 2010.

    2. I took a snapshot of this new facility using Snapshot Manager with the closure of XP Pro VM.  I named this snapshot 'PARENT - PRINTER' and then before him and correctly installed my network printer.  I can print to the printer.  Life is good.

    3. I then stop the machine virtual and made a new capture instant I named 'CHILD 1 - OFFICE 95'.  I then started "The CHILD 1 - OFFICE 95" snapshot and installed MS Office 95.  I rebooted and everything tested.  Is my network printer, I can print to it and all my Office 95 applications work.  Life is always good.

    4. I then stop the virtual machine and use Snapshot Manager to highlight the snapshot called "PARENT - PRINTER" and selected "go to."

    5. I then made a third called 'CHILD 2 - OFFICE 97' and starting the virtual machine snapshot.  Here is where the unexpected happens...

    -The first thing I noticed when the "CHILD 2 - OFFICE 97" started snapshot was that my network printer has been installed is no longer (the driver folder and everything's gone - for what is the virtual machine's printer was never installed)»»

    -The next thing I did was arrested and use the Snapshot Manager to ' go to ' snapshot 'PARENT - PRINTER '.  At the start of the snapshot 'PARENT - PRINTER', my network printer has been installed is no longer.  This left me very puzzled because it comes from the mother.  How the parent did get corrupted?

    -I then stop and used Snapshot Manager to ' go to ' snapshot 'CHILD 1 - OFFICE 95 ".  When I started this snapshot, my network printer has been installed but Office 95 was installed is no longer.

    It is repeatable - I tried it 3 times.    I'm doing something wrong?  Am I misunderstood how Snapshots should work?  Or is there a problem with my computer?  Curious minds want to know...

    Any idea / advice is appreciated and welcome.  Now, I find myself scratching my head.

    When you take a snapshot, it's a snapshot of the current configuration with the configuration.

    You must take the snapshot after installing drivers and applications!

    In your case it means that:

    1. Install the operating system and patches

    2. Take a snapshot named "Base - operating system installed"

  • Install printer drivers

  • Take a snapshot named "Parent-printers installed.

  • Install Office 95

  • Take a snapshot named 'Child 1 - Office 95 installed'

  • "Instant Goto" printers installed.

  • Install Office 97

  • Take a snapshot named "Child 2 - Office 97 installed"

  • I recommend you to take snapshots when the virtual machine is turned off.

    André

Maybe you are looking for

  • Who needs graphic hardware acceleration

    I brought the fifa Manager 2006 and I installed it and when I try and read it, it said "fifa manager 06 requires hardware graphic acceleration. I asked a man in the local computer shop and he said I should go to the toshiba website and download it, b

  • Doubt about the matrix or table

    I need to write some values that I read from the serial port. But I need to increment the column automatically each new number. What happens is that each new issue, the last of them turns to zero and I lost the number. How can I store the last number

  • typeRegeditdans def not ediatble VI

    I am a novice in LabVIEW and I put has the task to change a giant program. I'm having some difficulty in finding how certain behaviors of LabVIEW. I have this control (Type def), which would not let me do any kind of editing. I have boat access eleme

  • Windows vista does not start try the recovery disk and nothing

    I have a pavilion hp a1712n with windows vista starts not tried the disk recovery and nothing, it sounds like it is stuck in mode 'sleep'. I can hear it loading but it dosnt take the cd/dvd drive, I tried unpluging the drive to see if it will continu

  • How to make the menu drop-down list with a scroll bar

    Hello I have a drop-down list that is filled with different table sizes. I have a size of 30-element array.  Some of the last items just go off the screen at the bottom of the Simulator PB. Is it possible for me to add a drop-down scroll bar? DP = ne