How to interpret the current day of the month
I am a rookie in java and am trying to play with the Calendar class.
The DATE static field of this class says it returns "Field number for get and set indicating the day of the month."
So, Calendar.DATE has to return the current day of the month.
Today is 7th of january. So, it should return 7. But, I am getting a value of 5.
I am very much confused. I fell that my interpretation os wrong.
Please help.............
Thanks in advance.
You must NOT confuse the value of the constant Calendar.DATE (5) and how you can use that constant to retrieve the current day of the month.
Calendar cal = Calendar.getInstance(); // Gets the current date
int dayOfMonth = cal.get(Calendar.DATE); // Gets he current day of the month from the current date
// (Using the Calendar.DATE constant as method parameter).
System.out.println("Calendar.DATE = " + Calendar.DATE); // Prints the constant
System.out.println("dayOfMonth = " + dayOfMonth); // Prints the current day of month
Similar Messages
-
How to get the FIRST DAY OF THE CURRENT MONTH
how to get the FIRST DAY OF THE CURRENT MONTH in oracle 9i.
plzzzzz send immedaily.advance thanksTEST@test SQL> select trunc(sysdate,'MON') from dual;
TRUNC(SYS
01-OCT-06
TEST@test SQL> -
How can I find the last day of the current month
Is it possible to get the last day of the month in reports. Suppose I enter JUL in one of the text field. Now in reports I want to show that JUL contains 31 days. How can I retrieve the last day of the month.
Any ideas?The first (and fast) solution I think is this:
There is a function MONTH(CURRENT_DATE) that returns the number of the month of the current date.
Now, you could use CASE WHEN expressions to determine the number of days returned since you now how many days does every month have.
For instance, you could do:
CASE
WHEN MONTH(CURRENT_DATE)=1 THEN 31
WHEN MONTH(CURRENT_DATE)=2 THEN 28
WHEN MONTH(CURRENT_DATE)=3 THEN 31
WHEN MONTH(CURRENT_DATE)=4 THEN 30
END
PD. This is faster that use OR expressions like 1 or 3 or 5 because you dont have to try every option.
Hope it helps...but maybe there is another way more automatic.
Edited by: linkln on 03/09/2010 08:21 AM -
How to display the current day value in Numbers app?
In Numbers 3.2.2, where the current date and time happens to be 17 Dec. 2014 11:46am:
What formula will display the current date's numeral value?
What formula will display the current month's short name as text?
What formula will display the current year in four digits?
What formula will display the current time in the style "11:46am"?
Appreciated.I've taken the liberty of tweaking that handy script to format the date as requested by the OP:
on run {}
set right_now to (current date)
set short_month to text 1 thru 3 of (month of right_now as string)
set the_year to year of right_now as string
set the_day to day of right_now as string
set short_time to text 1 thru 5 of time string of right_now
set the_secs to time of right_now
if (the_secs / 2 as integer) < 21600 then
set am_pm to "am"
else
set am_pm to "pm"
end if
set s to space
set text_date to the_day & s & short_month & ". " & the_year & s & short_time & am_pm
set the clipboard to text_date
my paste_date()
end run
on paste_date()
tell application "Numbers"
activate
tell application "System Events"
keystroke "v" using {command down}
end tell
end tell
end paste_date
This considers 11:59:59 to be "am" and 12:00:00 to be "pm". (Edited after further consideration.) It has to be run either as an Automator service, or saved in ~/Library/Scripts/Applications/Numbers/ and run from Numbers' script menu. If run from Script Editor, it pastes the date into the end of the script itself.
Hope it helps,
H -
Is there a way to default the monthly calendar display
so that the current day always shows on top? ie, I want to always be able to see what's in the future 3-4 weeks, not what's in the past 3-4 weeks. The default monthly display is archaic--only allows you to see through the last day of the month. Suddenly today
is Oct. 30th, and I have a ton of projects lined up in November, but because I haven't been scrolling down every day, I haven't been aware of them every day. I realize there are other tools in Microsoft to help me stay on task, such as reminders and such,
but it would be helpful if I could always have the current day display on top of the monthly view so I can quickly scan what's coming up in the next few weeks.Thank you!
Right, I already have it in Month view. My question is a little more specific--I'd like for the current day to always display at the top. For example, today is Oct. 31st, so the current day is at the bottom of the calendar since it is the last day of the month.
I can view everything in October that I've already completed. What I can't see are the future weeks because we haven't hit November yet. I'd like for the current day to always display at the top of my calendar so I can always see what's coming in the following
three - four weeks (whether they're a part of that month or not). I've been to other forums trying to find the answer, and have come across the same exact question from frustrated users--but there seemed to be no solution. So I'm posing the question myself
in this forum. Do you know if this is possible? What I found from other forums is that Outlook defaults to a physical 'desk' type calendar format--so just as I'd use a paper calendar at my desk, I wouldn't be able to see the following weeks unless I either
flip the page to that month or I come to the first day of the next month, thereby tearing the the old month off and now only able to see the current month. That format is just so...paper...and archaic! Essentially I want the calendars to loop so it doesn't
even really matter what month it is--I just always want to see what lies ahead without having to scroll down. With our being in the Technology Age, I'd assume this is a logical expectation, but we may be stuck with the replica version of the paper-desk-calendar
format until Outlook programmers add this Technology Age feature in newer versions.
See, this month kind of messed me up because I have so many projects for November that start tomorrow and next week, but I haven't seen them until this week. I would have been better quipped--at least expecting them--had I been able to see all of those projects
since last week or the week prior.
If there is no solution to this answer, would you know how I can contact Outlook to provide feedback? I'm guessing a newer version is on its way...
Thanks again in advance! -
How to check whether current time satisfies the schedule?
I am working on a task, which is opposite of cron tab. My application is in groovy but can call all Java api. Can you please provide some pointers?
User is allowed to schedule a rule to be executed the way crontab gives the options. For example he wants the rule to be executed from Monday to Friday from 8 am to 5 pm.
I cans schedule in crontabe or Quartz. At run time I have to match, whether the current time satisfy the time condition entered by user.
I may have to store this information in the database the way we put in the cron. Eg. my tables will have following
Id|| Policy Id|| seconds|| minutes|| hours|| Day|| Date|| month|| year
1 || 5 || 1 || 1 || 8-17 || M-F||? || * ||*
Now while my code is getting executing, how can I match whether the current time matches the condition mentioned above.
Thanks in advance.[Using Span|http://tus.svn.sourceforge.net/viewvc/tus/tjacobs/util/] would make this easy
-
How to get the calendar days of last month in SAP HR Schema?
Hi all,
I have a question about the calendar days of last month, cause the customer calculated the salary not by natural month but cross-month, for example,
for calculating salary of Aug, the time period may be 7.28-8.27, so I need the days of this period which is the calendar days of last month exactly.
But I only knew GKSOLL was used for getting the calendar days of current month.
If any place wrong, please guide me.
Look forward to getting experts' help, thanks.
Regards,
May.Hi Sankarsan,
Thank you so much for your help.
The requirement I have described in detail when replying Viverk, you can take it as a reference.
Cause my customer don't want to use retro in SAP system, so I noted the schema about retro.
Now my question was how to get the last month calendar days in Schema. For example, now I am calculating the salary of July, the full attendance will be 30 days(06.28-07.27), in rule GKSOLL will get 31 days, so it's not right.
I hope you can get my point, below is the wrong rule.
Please guide me to correct it, thanks.
Regards,
May. -
How to get the current Date from the system?
How do I acquire the current date from the system? Also, if possible, can I assign the day, month and year separately into three variables and how? It would be thankful if some simple Example could be given. Thanx!
import java.util.*;
public class count {
public count() {
Calendar now = Calendar.getInstance();
int month = now.get(Calendar.MONTH);
int day = now.get(Calendar.DAY_OF_MONTH);
int dayyear = now.get(Calendar.DAY_OF_YEAR);
int year = now.get(Calendar.YEAR);
int a = 365;
int b = a - dayyear;
System.out.println("The day is the" + " " + day);
System.out.println("IT is the" + " " + month + " " + "month of the year");
System.out.println("The year is" + " " + year);
System.out.println("This many days till next year" + " " + b);
public static void main(String[] args) {
count cou = new count();
} -
On iPad 3, all of my calendar items lasting more than one day do not appear correctly when looking at the monthly view of the calendar; only the first day of the appointment appears. For example, if I am taking a vacation for 4 days, only the first day of the vacation is marked on the calendar, instead of being listed on all 4 days. When I look at the weekly view, however, it is correct and is listed on all 4 days. The problem here of course is that at a glance, there is no way to look at my monthly schedule. On my iPhone, everything is correct, regardless of month or week view, so clearly this is an iPad problem I guess? Please advise on how this can be corrected. Thank you!
Unfortunately you can't do what you want. Many people have complained to Apple about this. I suggest you provide Apple feedback directly at http://www.apple.com/feedback/macosx.html. They will not provide a direct response but hopefully if enough people provide feedback Apple will fix this.
-
How to get the last day of the payroll period
Hi all,
I need to get the last day of the payroll period e.g. last day of Jan 2007 is 31 Jan 2007. Can anyone suggest as to how to get it?
Thanks,
MadhuT549S contains the payroll periods with pay date. T549Q contains the begin and end dates of the payroll period.
You can select from the appropriate table (or from both depending on your given data) to get the end date of the period.
Hope that helps.
Mary -
How to get the last day of a month?
HI,
I want to know how to get the last day of a month.
In my JClient form, I tried to get it by using oracle.sql.Date method, that is:
lastday=oracle.sql.Date anydate.lastDayOfMonth();
But it does not work. The result is lastday=anydate.
Why?
StephenYou can use the Calender class...
Calendar c = Calendar.getInstance();
and then something like...
c.add(c.MONTH, 1);
int dayOfMonth = c.get(Calender.MONTH);
c.add(c.DAY_OF_MONTH, - (dayOfMonth-1) );
other usefull functions are:
System.out.println(" YEAR : " + c.get(Calendar.YEAR));
System.out.println(" MONTH : " + c.get(Calendar.MONTH));
System.out.println(" DAY_OF_MONTH : " + c.get(Calendar.DAY_OF_MONTH));
System.out.println(" DAY_OF_WEEK : " + c.get(Calendar.DAY_OF_WEEK));
System.out.println(" DAY_OF_YEAR : " + c.get(Calendar.DAY_OF_YEAR));
System.out.println(" WEEK_OF_YEAR : " + c.get(Calendar.WEEK_OF_YEAR));
System.out.println(" WEEK_OF_MONTH : " + c.get(Calendar.WEEK_OF_MONTH));
System.out.println(" DAY_OF_WEEK_IN_MONTH : " + c.get(Calendar.DAY_OF_WEEK_IN_MONTH));
System.out.println(" HOUR : " + c.get(Calendar.HOUR));
System.out.println(" AM_PM : " + c.get(Calendar.AM_PM));
System.out.println(" HOUR_OF_DAY (24-hour): " + c.get(Calendar.HOUR_OF_DAY));
System.out.println(" MINUTE : " + c.get(Calendar.MINUTE));
System.out.println(" SECOND : " + c.get(Calendar.SECOND));
System.out.println();*/ -
How to get the last day of the previous month
Hello Team,
If my input date is today , then i need to find out the last day of the previous month for the same.
Can someone help me to find out .. how can this be done.
Regards,
RaviHi,
Try the below code.
// get a calendar object
GregorianCalendar calendar = new GregorianCalendar();
// convert the year and month to integers
int yearInt = Integer.parseInt(year);
int monthInt = Integer.parseInt(month);
int dayInt = Integer.parseInt(day);
// adjust the month for a zero based index
monthInt = monthInt - 1;
// set the date of the calendar to the date provided
calendar.set(yearInt, monthInt, dayInt);
int day = calendar.getActualMaximum(GregorianCalendar.DAY_OF_MONTH);
return Integer.toString(day);
Regards
Venkat -
BIP eBusiness Suite Dates - How to include the last day of the month?
How can I get my report to include the last day of the month 'without' forcing my users to enter the non-intuitive first of the next month as a parm?
I have a report that will generally be run for a month but can be run for any pair of dates representing the first and last date to be included in the report.
When we pass the dates from Oracle Apps to the report it is truncating the date to midnight. This results in the last date entered 'NOT' being included in the report as the second date is marked as "midnight". When I attempt to simply add "=1" to the end date it fails due to formatting issues in apps (only). I have gotten this to work on our Enterprise edition server that we use for testing (only) but it fails in our apps environment.
In APPs we input the date in the format "01-AUG-2007", and this is how it shows in the parm line before the report is submitted as well as in the "View Details" after the report is executed: http://home.swbell.net/grog1//work/req_details_5607586.jpg
However it is odd in that we in the "View Log" entry it shows the date formatted as "2007/08/01 00:00:00": http://home.swbell.net/grog1/work/view_log_5607586.jpg
Even odder is that under diagnostics, "View XML" the date is formatted third way as: "2007/08/01 00:00:00.0" (note it now includes tenths of a second): http://home.swbell.net/grog1/work/view_xml_5607586.jpg
This of course makes it difficult to perform conversions and calculations on the date in the SQL.
Is APPs doing some sort of 'timestamp' conversion?
How can I get my report to include the last day of the month 'without' forcing my users to enter the non-intuitive first of the next month as a parm?
Any feedback is appreciated,
ScottNo. The problem/error occurs long before the data is formatted into xml for presentation to the format template.
The error occurs in the SQL in the 'data' template when I attempt to add a day to the date. It either does not like the implicit conversion with the "+1" and then the use of the "between" with another date or if I attempt to manually convert it has problems with the format mask.
Scott -
How do I set a reminder for the last day of every month
Have I missed something? But how do you set a reminder for the last day of every month to recurr indefinatley in iOS6? Sorry if this is really simple but I just can't seem to work it out. Any help gratefully received.
Hey Mattye88 not sure if you have seen but actully you can do this, but for some reason you have to use Siri. If you bring up Siri and say "set a reminder ever 4 weeks from next wednesday to check the gas meter" it will set one and it will work just fine, I have reminders to water a Bonsai every three days and it works fine it just shows as custom repeat on the user interface. Alas it seems you can not use Siri to set one for the end of the month though which is why I am in this threed. Still hope it helps you to know how to sort this problem atleast.
-
How to get the Current User on the UI page?
All,
Could you please let me know how to get the Current user on the UI input page , i need to display the current user ID when some one clicks the submit button, i want o get the current user to display in the javascript alert box.
Edited by: 951930 on Oct 24, 2012 12:21 PMlucky,
my schema has already defined for
<user mapField="USER_ID" default="%CurrentUser"/>
and in my UI page
<td oraLabel="user"></td><td oraField="user" id="userId" ></td>
and my javascript
function showUserId () {
var curUser = document.getElementById('userId').value;
alert(curUser);
and i have called this function on my submit button, but i am not able to get Current Logged User ID value to show in the alert nor able to show the current logged user on the UI page.
my requirement is on custom UI page i need to show Current Logged User in one corner of the page and also need to show the same user in alert when he submits the button.
Appreciate for the help.
Edited by: 951930 on Oct 25, 2012 8:42 AM
Edited by: 951930 on Oct 25, 2012 9:06 AM
Maybe you are looking for
-
Error message on iTunes when trying to open iTunes Home page?
I'm not trying to find a song or anything, I just want to get onto the iTunes store home screen but this comes up??
-
TS2890 cannot find store under settings on my ipod touch
I have an older ipod touch and want to access the store but it will not let me connect to Itunes store. I cannot find the store under settings to setup my apple account. Is this because I have an old ipod touch? Thanks
-
3-2-1 widget no longer working on Dashboard
I've been using the countdown application '3-2-1' for a year or so without problem. Very useful. A few days ago I opened Dashboard and found that 3-2-1 icon had gone very dim and would not respond. I tried deleting and adding it from the d
-
Read a csv file and read the fiscal yr in the 4th pos?
Hello ABAP Experts, how to write a code for read a csv file and read the fiscal year in the 4th position. any suggestions or code highly appreciated. Thanks, BWer
-
Using Elements 9, how can I add a caption with names in a blank white space under a photo of a group of people?