My Question On Calendar and Date

Hi, I am making a query to a table: T_HR_CONTRACT,
which stores the labor contract of a company.
END_DATE is a field of table T_HR_CONTRACT. Its type is date.
Now, I need to search the contract end in each month.
select * from T_HR_CONTRACT where fEND_DATE >= theStartDayOfCurrenctMonth and fEND_DATE < theStartDayOfNextMonth;
or
select * from T_HR_CONTRACT where fEND_DATE >= theStartDayOfCurrenctMonth and fEND_DATE <= theLastDayOfCurrenctMonth;
How can I utilize the java class Calendar or Date to get
the first day of current month,
the last day of current month,
the first day of next month?
I am new to Calendar and Date class. Please give me some help!

Ok, I have solve the problem as following:
//get the first day of this month, by using StringBuffer, we can enhance
//the effiency
StringBuffer today = new StringBuffer();
Calendar rightNow = Calendar.getInstance();
today.append(rightNow.get(rightNow.YEAR));
today.append("-");
today.append((rightNow.get(rightNow.MONTH) + 1));
today.append("-01");
String todayDate = today.toString();
//get the first day of next month
StringBuffer next = new StringBuffer();
//if the month is December, then get the first day of next year!
if(rightNow.get(rightNow.MONTH) == 11)
next.append(rightNow.get(rightNow.YEAR) + 1);
next.append("-01-01");
else
next.append(rightNow.get(rightNow.YEAR));
next.append("-");
next.append(rightNow.get(rightNow.MONTH) + 2);
next.append("-01");
String nextDate = next.toString();

Similar Messages

  • My question On Calendar or Data

    Hi, I am making a query to a table: T_HR_CONTRACT,
    which stores the labor contract of a company.
    END_DATE is a field of table T_HR_CONTRACT.
    Now, I need to search the contract end in each month.
    select * from T_HR_CONTRACT where fEND_DATE >= theStartDayOfCurrenctMonth and fEND_DATE < theStartDayOfNextMonth;
    or
    select * from T_HR_CONTRACT where fEND_DATE >= theStartDayOfCurrenctMonth and fEND_DATE <= theLastDayOfCurrenctMonth;
    How can I utilize the java class Calendar or Date to get
    the first day of current month,
    the last day of current month,
    the first day of next month?
    I am new to Calendar and Date class. Please give me some help!
    Thank you!

    GregorianCalendar c = new GregorianCalendar();
    // That gets a Calendar object containing the current date and time.
    c.set(Calendar.DAY_OF_MONTH, 1);
    // As you might guess that sets the Calendar's day to be the first of the month.
    c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH));
    // That sets the Calendar's day to be the first of the month.
    c.add(Calendar.DAY_OF_MONTH, 1);
    // That adds 1 to the day... what does that give you?You could have learned a lot of this by reading the examples given in the API documentation for Calendar and GregorianCalendar. Try it next time, you may find it faster than waiting for some random person to answer your question.

  • 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

  • Question about voice and data plan for Europe

    I am in New York and my boss is going to France for a week and a half. He told me he will not have access to the internet there. He asked me to find out if it would be possible to get a voice and data plan for the month that he will be there, and if so, could someone show me where I could look at the different plans available?
    If it's not possible to do that for just a month, then could someone tell me where I could find the rates are for voice and data in France?
    Thanks

    Hi kevindrosario,
    I appreciate your interest in our International Services.  France, is a GSM country and will only support a Global capable device. Unfortunately, its not clear if your boss has a Global capable device.  If so, here are the details for the voice and data rates for France.
    If your boss doesn't not have a Global capable device, no worries!  We offer an Occasional Global Traveler program, in which we will loan you a Global device for up to 21 days.  I hope this information is helpful.  Please let me know if you have any any additional questions or concerns.
    Thank you,

  • Deployment question for EMS and Data Objects

    I have configured tens of EMS and data objects. It's deployment time to a new environment, say Dev to Test. Do i have to manually create all this data objects and EMS in each environment, or is it possible to write a script or deployment script to do it automatically for each environment. If not, it will be a headache configuring all these DO and EMS again for eah environment. Please suggest.
    Thanks

    See this guide: http://download.oracle.com/docs/cd/E15523_01/core.1111/e10105/testprod.htm#CHDDIEBI
    Specifically on the usage of icommand in section 20.4.2

  • Calendar and Date objects

    I've got an application that has many Date objects. We frequently have to do comparisons to see if two Date objects represent the same day. I know that I can use a SiimpleDateFormatter to make a String from a Date. I can compare two of these Strings and determine if they are on the same day.
    I also know that I can make two new Date objects from the milliseconds in a pair of Date objects, and set the hour, minute, seconds and milliseconds to zeros. Then, the compareTo method to see if the two days match. But, both of these seem like a huge overhead when I have to do it a lot. (Although the objects are called Date, the compareTo matches the milliseconds version, and so two Date objects from the same day do not match unless they match to the millisecond. Not what I want.)
    Have I overlooked something that returns a nice int or long "Julian day number" field that is quick?
    If I can assure myself that all of the dates were built with a common TimeZone, could I divide by the milliseconds in a day to get a nice day number?

    Maybe an example would clear things up.
    This is a large scheduling application, with a very complex GUI.
    We find out from a database that an activity runs from December 28, 2008 at 10:31AM to January 2, 2009 at 11:45AM.
    The first question after we have converted each date/time pair to a Date object is: "On how many days does this activity take place?" In this case it is 6 days Dec 28, Dec 29, Dec 30, Dec 31, Jan 1, and Jan2. This will be displayed in a JTable with 6 columns. The ideal (at least to me) solution would be to get a day number as described above for the start and end, and know that (end_day - start_day + 1) columns are required, and we can write a for loop to go from the start day to the end day. If we use a semi-day value of the (year*1000 +DAY_OF_YEAR) we have a unique number, but it is useless for determining how many columns are needed in a table. The comparison between 2008363 and 2009002 does not produce a usable result.
    But, there are related operations as part of a more significant activity. We usually have to decide how many days (columns) does it take to display a group of activities. At this level, we don't care what time of days are involved.
    This application is on the desktop of multiple schedulers who will move activities around all day long. We need to be as efficient as possible, since some of the other things are very compute intensive.
    In parts of the application we are very much concerned about time of day, (for example, the custom table cell renderer paints a stripe across the cell of each table cell with a length proportional to the time of day start and end) but in other parts, the day is the main concern.
    I was bothered by the number of Date to Calendar to String conversions being done, and knowing that Date-to-Calendar is not simple due to time zone issues. I also know that Calendar-to-String conversions are not simple since the SimpleDateFormatter has to dynamically interpret a formatting string.
    It looks like I'm just stuck with the way it is, unless the alternative date/time implementation is used. That looks a bit promising.

  • Question on CKM and Data Quality

    As I understand, CKM only supports the check based on db constraints. If I want to have more complicated business logic built to the checking, does Data Quality sound like a good choice. Or other suggestions?
    In my case, I will need to check the data in the source table based on the table data from different sources (both target and source tables). This should be doable through data quality, correct? I am new to ODI. When I first installed the ODI, I didn't choose to install data quality module. I suppose I can install DQ separately and link it back to ODI? Do they share the same master repository?
    Sorry for the naive questions, you help is greatly appreciated.
    -Wei

    Hi,
    My idea is just like:
    for instance a FK validation:
    create function F$_validate_FK (value1 number) return number
    as
    v_return number;
    begin
    select my_fk into v_return from any_table where column_fk = value1 ;
    return v_return ;
    exception
    When NO_DATA_FOUND then
    return -1;
    end;
    And at constraint you will have:
    -1 = (select F$_validate(table1.column_to_be_validated) from dual)
    Any record that have -1 as return will be not valide for the flow.
    The F$ function can be created in a ODI procedure before the interface and dropped at end if you think to be necessary.
    Make any sense?
    (Maybe there are several syntax error in this example, I just write it and did not compilate, just to show the idea)
    Edited by: Cezar Santos on 28/04/2009 10:20

  • A question about UDA and Data-Forms

    Hi all,
    I have a couple of questions about UDA. I am using Hyperion Planning 11.1.1.3m, and when I desing a Data-Form I would need to use the UDA I asigned for the Entity dimension: is that posiible?
    The other question is, when creating a Substiution Variable in Essbase I use the function @UDA (+dimension+, "MemberA"), but when using this variable in the Data-Form, it does nothing at all(in fact, it is been detected as an error). Why is that happening?
    Thanks a lot

    Use an attribute dimension to achieve what you are trying to do with UDA's in a data form. An attribute dimension will allow you to filter on members in the base dimension by a specific attribute the same way a UDA will. You can create the attribute dimension in the dimension editor in Planning by selecting the base dimension (Entity) and then select the custom attributes' button. Check the dba guide for a step-by-step approach.
    With regards to the subvar, are you trying to add the function as a value of the subvar when you create it in EAS? If so, this is not allowed. What are you trying to do with the subvar on the form? Subvars are supported in data forms as part of the member selection for a dimension. For instance, you can set up a subvar called CurYear and set the value equal to FY11 for the Fiscal Year dimension. In the data form you can set the member selection for the Fiscal Year dimension to CurYear. When the user opens the form, the member FY11 is returned.

  • Popup Calendar and date fields

    I have two date fields on a form with one field having a "MM/DD/YYYY HH:MI" date format and the other having a "MM/DD/YYYY" date format. The calendar that pops up for the field with a timestamp requires the user to choose the time, a date, then click on the OK button. The other calendar will automatically choose the date and close the calendar when the user clicks on a date. Is there any way I can get the calendar with the timestamp to have the same functionality as the "regular date" calendar? In other words, can the popup calendar automatically close when the user chooses a date when the time is shown on the calendar?
    Thanks in advance,
    Dan

    DTP,
    I don't know if you'd be interested in trying something completely new but with jQuery you could use a completely serverside solution by combining jQuery with uidatepicker and clockpick...
    Check these out:
    http://marcgrabanski.com/code/ui-datepicker/
    http://www.oakcitygraphics.com/jquery/clockpick/trunk/ClockPick.cfm
    Getting started with jQuery can be a little confusing at first. But if you stick with it there are many benefits!
    Regards
    Dan

  • Two iPhone questions (existing customer and data plan)

    Hello, I have two questions about the iPhone. I am on a family plan with At&t. I don't pay my bill. I want to keep it that way. Will I just be able to take my sim card out of my phone and put it in the iPhone since it's AT&T? Or do I use a new sim card and when activating it choose existing customer?
    My second question is I am wondering if it is possible to use an iPhone without the data plan. I know I will be missing visual voicemail and edge but I don't care. Also, will this make me get a thousand dollar bill if I accidentally press safari and don't have a data plan? Thanks.

    friend18 wrote:
    Hello, I have two questions about the iPhone. I am on a family plan with At&t. I don't pay my bill. I want to keep it that way. Will I just be able to take my sim card out of my phone and put it in the iPhone since it's AT&T? Or do I use a new sim card and when activating it choose existing customer?
    You can't use the SIM from your existing phone. You would use the new SIM and activate as an existing customer.
    My second question is I am wondering if it is possible to use an iPhone without the data plan. I know I will be missing visual voicemail and edge but I don't care. Also, will this make me get a thousand dollar bill if I accidentally press safari and don't have a data plan? Thanks.
    You have to get the data plan and for $20 it's worth it, not only is it unlimited data but includes 200 text messages. Without the data plan, you'll pay for every voicemail you access, every text message, any time you check weather/email/youtube/etc. In a nutshell, the data plan covers a lot more than just using Safari to browse the web.

  • Question re: G8264 and "DATA"

    Is there a way in the G8264 to force using the DATA rather than MGT path?
    Instead of appending "DATA" to commands can you make it the default?

    Thanks...I see that I can:
    - use title (seems to default to filename if I haven't given the photo a 'name' in iPhoto, which I haven't)
    - use filename (issue of overwriting 'original' that I have exported)
    - use sequential (with option to specify prefix - ends up with 'edited' photos having quite different filenames from the 'original'...)
    - use album name plus number
    I think I realise that the problem is no so much not being able to get the originals and edits into the same folder, rather be not being able to do it quite the way I'd like...ideally, I'd like to give the edited file a suffix, i.e.
    P12345678.jpg for the original
    P12345678a.jpg for the edited version
    That way they sit together in the folder and I can see at a glance that they're versions of the same photo...a minor issue really, and probably not something that any other programmes can do to a 'batch' of files either.  The easiest way seems to be to use "event name" under subfolder format for the edited shots, which automatically creates a new sub-folder, keep the names and the edit (add suffixes, in this case) in finder...
    Thanks for the smart folder tip.

  • How do you date and time stamp iCal entries?  We share an event calendar and need to know when a new event was entered into iCal.

    How do you date and time stamp iCal entries?  We share an event calendar and need to know when a new event was entered into iCal.

    BKBK,
    Thank you for your response. That does adequately cover the
    client-originated sessions, but still leaves the ability I am
    looking for unavailable.
    It did serve to definitively answer my most pressing
    question, however, with this statement:
    Note: ColdFusion cannot create a session if an initiator
    application uses a SendGatewayMessage method to start an
    interaction with a client, such as an SMS user. In this case, the
    sending code must keep track (for example, in a database) of the
    messages it sends and their destinations. When a response event
    arrives, it can look up the origniatorID to determine whether it
    was in response to an outgoing message.
    I will play around with the Application scope to see if there
    might be a workable solution there.
    RLS

  • Question about saving calendar and contatcs

    Good Morning to all ,
    I have a question about how to transfer the calendar and contatcs files to the new outlook profile after a imap migration. So what is the best way to transfer this kind of data before the imap migration for example to prep 70 machines? Any Powershell or
    vbs script to save the calendar and contatcs into a pst file?
    Thank you in advanced.
    Thiago.

    So what is the best way to transfer this kind of data before the imap migration for example to prep 70 machines? Any Powershell or vbs script to save the calendar and contatcs into a pst file?
    Without knowing Outlook version involved and/or whether there are any additional email accounts configured in any given profile beyond the one being migrated to IMAP - some general comments
    #1 - Simply add the same email account as an IMAP account to the same profile. That will result in the "default data file" remaining the same which contains the default "contact & calendar" folders. There is nothing that limits the
    same email account to be configured with multiple protocols unless there is a setting that also needs to be set at the server level (i.e. GMail)
    #2 - Delete the related "non-Imap" account from the profile - that is has no impact on the data file associated with the account
    At a minimum - Contacts/Calendar folders remain as is with the only caveat being that the email folders in the original PST file will contain data which you (your users) may or may not want to completely get rid of (something you may want to check/confirm
    beforehand)
    Karl Timmermans [Outlook MVP] "Outlook Contact Import/Export/Data Mgmt" http://www.contactgenie.com

  • Calendars and event data lost in mountain lion upgrade from snow leopard on mac book pro

    I just upgraded to mountain lion today. It appears my contacts and emails were transferred without loss to the new system but all of my calendar data and the calendars themselves have disappeared. Does anyone know how I can get my old calendars and event data back? I backed up my laptop on time machine before doing the upgrade, so my old calendars should be on my external hard drive. I'd like to simple recover the data from the laptop if it is just hidden somewhere. Alternatively, if someone could tell me how to import the backed up calendars back in that might be a good plan B. I also still have the old calendars on my iphone which I am afraid to sync for fear of data loss.
    I looked through previous responses in the community to this same question and I tried deleting the account and adding it back in but that did not work. Any assistance would be appreciated. Apple support is giving me an cold shoulder that is rather unexpected given my past good experience with Apple support. Bummin out over here
    Aneata

    Which way do you reinstall OSX?
    I would go through the recovery partition, check Disk there and then run the installer. make sure you have a reliable connection the the Internet.
    This could be a third party app you have running in the background that is crashing. what exactly is crashing ?
    are you getting kernel Panics?
    You are not able to simply roll back to Snow Leopard, you will have to have a SL disk, and then erase and install SL onto you hdd/ssd. This will erase ALL of your data so I hope you have a Time Machine backup or bootable clone.
    I believe your issue is with a third party application installed.
    More information is needed.
    Call 1-800-My-Apple or file a dispute here https://expresslane.apple.com/Issues.action
    On a personal note, I think you are missing out on ML and need to figure out if there is an application running that is causing ML to crash.
    Usually a reinstall fixes my issues.

  • Two questions: Event on a Date Picker and Read Only on a full page?

    Hello,
    I make use of this very informative board to develop an application but i have been unable to find info on these two topics. Sorry if it has been already discussed extensively.
    Using HTMLDB 2.2 for now.
    =>First question:
    I have a date picker item with an event
    onChange="resaStatusChange();"
    in the HTML Form Element Attribute field.
    The event is triggerring if i put a new data in the field but does not trigger if i use the picker.
    Is it a standart behaviour? Is there a way to trigger the event when new data is provided through the date picker?
    => Second question:
    One page in my application has to be used either to only display information or as a mixed displaying/entering data sheet.
    When the context is appropriate to use the page as a simple display (testing both global authorization and data to be displayed), is there a way to put a read only attribute on the full page instead of putting the read only conditions through each and every item of the page?
    Sorry if the questions are not clear and apologize for what should be newbie questions.
    Any link or info will be appreciated.
    Regards,
    Daniel Gureghian

    Hi Daniel,
    I'm not sure about your first question, but I can hopefully give you a helpfull answer for your second one.
    I'm handling it this way:
    var elInput = document.getElementsByTagName('input');
    var elTextArea = document.getElementsByTagName('textarea');
    var elSelect = document.getElementsByTagName('select');
    for (i = 0; i < elInput.length; i++)
      setReadOnly(elInput, true);
    for (i = 0; i < elTextArea.length; i++)
    setReadOnly(elTextArea[i], true);
    for (i = 0; i < elSelect.length; i++)
    setReadOnly(elSelect[i], true);
    function setReadOnly(pThis, pRead)
         if (pThis && pRead)
              pThis.disabled = pRead;
              pThis.style.emptyCells = "show";
              pThis.style.color = "black";
              pThis.style.backgroundColor = "#DDDDDD";
         else if (pThis && !pRead)
              pThis.disabled = pRead;
              pThis.style.emptyCells = "show";
              pThis.style.color = "black";
              pThis.style.backgroundColor = "#FFFFFF";
    I never used it on a whole page, only for regions. So maybe you have to make some changes.
    chrissy

Maybe you are looking for

  • MacBook Pro won't boot at start.  I get a white screen with a blinking folder with a question mark in the middle. Any ideas?

    MacBook Pro won't boot at start.  I get a white screen with a blinking folder with a question mark in the middle. Any ideas?

  • Connecting to dsl

    I have a linksys WRT54G I switched from Comcast to ATT dsl this week and my router will not recognise my modem.  I have uninstalled and reinstalled a few times to no avail.  I was told by an online rep that ATT does not support Linksys and that for a

  • CF8 Standard and Oracle

    I recently had a server die that was running an old old cf4.5 enterprise with oracle. I just purchased the coldfusion 8 standard (no $ for enterprise right now) and I need to connect to the oracle database. Is there any instructions on doing this? pl

  • All of my colors have turned greyscale!

    Not sure what happened here, but when I draw a box or create text and try to fill in with any color, it gets filled with a shade of grey. I have no idea how I activated this "feature", but I need to get back to color mode. How do I do this? Mac OS X

  • Are session-scoped beans singleton

    Hi all, I miss something in the bean lifecycle within JSF. Assume that a page action navigates toward another page, linked to a session-scoped bean: this is created for the duration of this session. Then a button leads back to the original page, so t