Search Results

Search found 12481 results on 500 pages for 'date picker'.

Page 4/500 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • JQuery UI Datepicker date format issue with initial value

    - by Mithun
    I need to set the initial date for the date picker to 03/20/2010 in mm-dd-yyyyy format. I have done this <input id='datepicker' type='text' value='20/03/2010' /> But my problem is on clicking the field date picker populates with today's date as highlighed and no date selected, and up on selecting date value But when i change my input field like one below <input id='datepicker' type='text' value='03/20/2010' /> Date picker is populating March 20 as selected date and current date highlighted. But all in 'mm-dd-yyyy' format! I want show all dates in 'dd-mm-yyyy' format. How can I solve this?

    Read the article

  • HQL make query searching by date (Java+NetBeans)

    - by Zloy Smiertniy
    Hi all I have the following issue. I have a table of reserves in my MySQL DB, the date columns is defined DATETIME. I need to make a query using hibernate to find all reserves in one day no matter the hour, just that its the same year month and date, and I'm doing this public List<Reserve> bringAllResByDate(Date date){ em = emf.createEntityManager(); Query q = em.createQuery("SELECT r FROM Reserve r WHERE r.date=:date "); q.setParameter("date", date); ... I really dont know how to make it compare, and bring me just those from the specified date, any help??

    Read the article

  • Given a date range how to calculate the number of weekends partially or wholly within that range?

    - by andybak
    Given a date range how to calculate the number of weekends partially or wholly within that range? (A few definitions as requested: take 'weekend' to mean Saturday and Sunday. The date range is inclusive i.e. the end date is part of the range 'wholly or partially' means that any part of the weekend falling within the date range means the whole weekend is counted.) To simplify I imagine you only actually need to know the duration and what day of the week the initial day is... I darn well now it's going to involve doing integer division by 7 and some logic to add 1 depending on the remainder but I can't quite work out what... extra points for answers in Python ;-) Edit Here's my final code. Weekends are Friday and Saturday (as we are counting nights stayed) and days are 0-indexed starting from Monday. I used onebyone's algorithm and Tom's code layout. Thanks a lot folks. def calc_weekends(start_day, duration): days_until_weekend = [5, 4, 3, 2, 1, 1, 6] adjusted_duration = duration - days_until_weekend[start_day] if adjusted_duration < 0: weekends = 0 else: weekends = (adjusted_duration/7)+1 if start_day == 5 and duration % 7 == 0: #Saturday to Saturday is an exception weekends += 1 return weekends if __name__ == "__main__": days = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] for start_day in range(0,7): for duration in range(1,16): print "%s to %s (%s days): %s weekends" % (days[start_day], days[(start_day+duration) % 7], duration, calc_weekends(start_day, duration)) print

    Read the article

  • JQuery Validation [migrated]

    - by user41354
    Im trying to get my form to validate...so basically its working, but a little bit too well, I have two text boxes, one is a start date, the other an end date in the format of mm/dd/yyyy if the start date is greater than the end date...there is an error if the end date is less than the start date...there is an error if the start date is less than today's date...there is an error The only thing is when I correct the error, the error warning is still there...here is my code: dates.change(function () { var testDate = $(this).val(); var otherDate = dates.not(this).val(); var now = new Date(); now.setHours(0, 0, 0, 0); // Pass Dates if (testDate != '' && new Date(testDate) < now) { addError($(this)); $('.flightDateError').text('* Dates cannot be earlier than today.'); isValid = false; return; } // Required Text if ($(this).hasClass("FromCal") && testDate == '') { addError($(this)); $('.flightDateError').text('* Required'); isValid = false; return; } // Validate Date if (!isValidDate(testDate)) { // $(this).addClass('validation_error_input'); addError($(this)); $('.flightDateError').text('* Invalid Date'); isValid = false; return; } else { // $(this).removeClass('validation_error_input'); removeError($(this)); if (!dates.not(this).hasClass('validation_error_input')) $('.flightDateError').text(' '); } // Validate Date Ranges if ($(this).val() != '' && dates.not(this).val != '') { if ($(this).hasClass("FromCal")) { if (new Date(testDate) > new Date(otherDate)) { addError($(this)); $('.flightDateError').text('* Start date must be earlier than end date.'); isValid = false; return; } } else{ if (new Date(testDate) < new Date(otherDate)) { addError($(this)); $('.flightDateError').text('* End date must be later than start date.'); return; } } } }); The main Issue is this part, I believe // Validate Date Ranges if ($(this).val() != '' && dates.not(this).val != '') { if ($(this).hasClass("FromCal")) { if (new Date(testDate) > new Date(otherDate)) { addError($(this)); $('.flightDateError').text('* Start date must be earlier than end date.'); isValid = false; return; } } else{ if (new Date(testDate) < new Date(otherDate)) { addError($(this)); $('.flightDateError').text('* End date must be later than start date.'); return; } } } testDate is the start date otherDate is the end date Thanks in advanced, J

    Read the article

  • Check if date is allowed weekday in php?

    - by moogeek
    Hello! I'm stuck with a problem how to check if a specific date is within allowed weekdays array in php. For example, function dateIsAllowedWeekday($_date,$_allowed) { if ((isDate($_date)) && (($_allowed!="null") && ($_allowed!=null))){ $allowed_weekdays=json_decode($_allowed); $weekdays=array(); foreach($allowed_weekdays as $wd){ $weekday=date("l",date("w",strtotime($wd))); array_push($weekdays,$weekday); } if(in_array(date("l",strtotime($_date)),$weekdays)){return TRUE;} else {return FALSE;} } else {return FALSE;} } ///////////////////////////// $date="21.05.2010"; $wd="[0,1,2]"; if(dateIsAllowedWeekday($date,$wd)){echo "$date is within $wd weekday values!";} else{echo "$date isn't within $wd weekday values!"} I have input dates formatted as "d.m.Y" and an array returned from database with weekday numbers (formatted as 'Numeric representation of the day of the week') like [0,1,2] - (Sunday,Monday,Tuesday). The returned string from database can be "null", so i check it too. Them, the isDate function checks whether date is a date and it is ok. I want to check if my date, for example 21.05.2010 is an allowed weekday in this array. My function always returns TRUE and somehow weekday is always 'Thursday' and i don't know why... Is there any other ways to check this or what can be my error in the code above? thx

    Read the article

  • How can I set the date format to my country setting?

    - by Jamina Meissner
    I am German, but I use only English software. Hence, I am also using English Ubuntu. It's not because I don't know how to install German Ubuntu. It's because I prefer to work with English software environment. However, I would like to keep date & time format in German format, just as I use a German keyboard layout in English Ubuntu. I can set the time format to 24h time. But how can I set the date format to German time format? It is irritating for me to have the day number before the time numbers: In other words, instead of "Oct 14 15:16" I want it to display "14 Okt" or (if only English language is available) "14 Oct 15:16" or "14th Oct 15:16". At least, the number of the day should be displayed before the month. In Windows, it was no problem to choose time/date/currency settings according to a chosen country. Where can I do this in Ubuntu? The best would be if I could freely enter the date/time format myself with variables (DD.MM hh.mm.ss etc). I found answers for Ubuntu 11.04, but not for Ubuntu 12.04. I am using Ubuntu 12.04, 64-bit. Keep in mind that I am a beginner. So I'd like to be able to do this via GUI, if possible. EDIT: I found the answer in a forum. Go to System Settings... and choose Language Support. There are two tabs, Language and Reginal Formats. You are by default on the Language tab. On the Language tab, click Install / Remove Languages. A window with a list of languages opens. Mark the language(s) you want to add for your time/date/currency format. Click Apply Changes. Ubuntu will now download and install the additional language files, as well as help files of other applications in this language. So don't be irritated. When Ubuntu has finished applying the changes, switch to Regional Formats tab. (Do not change the Language for menus and windows on the Language tab if you only want to change the date/time/unit format). There you can choose from the dropdown list the language for your preferred format for date/time/currency/unit. Log out and log in again to have the changes take effect.

    Read the article

  • How to get most recent date from an array of dates?

    - by sugarFornaciari
    Hy guys I have an array of dates such as array(5) { [0]=> string(19) "2012-06-11 08:30:49" [1]=> string(19) "2012-06-07 08:03:54" [2]=> string(19) "2012-05-26 23:04:04" [3]=> string(19) "2012-05-27 08:30:00" [4]=> string(19) "2012-06-08 08:30:55" } I would like to know which is the most recent date, comparing to the today date. Do you have any idea to do that?

    Read the article

  • Date object to Calendar [Java]

    - by Samuel
    Hello World, I have a class Movie in it i have a start Date, a duration and a stop Date. Start and stop Date are Date Objects (private Date startDate ...) (It's an assignment so i cant change that) now i want to automatically calculate the stopDate by adding the duration (in min) to the startDate. By my knowledge working with the time manipulating functions of Date is deprecated hence bad practice but on the other side i see no way to convert the Date object to a calendar object in order to manipulate the time and reconvert it to a Date object. Is there a way? And if there is what would be best practice Thanks in advance Samuel

    Read the article

  • control panel date&time is considered while using "new date()" javascript function.

    - by Rupa
    Hi, I am getting a client date in javscript function using "new date()" object. But this object is considering the properties set for Date&Time control in the control panel of the system. For example, If I check the check box of Date&Time control of the system (control panel) "Automatically adjust clock for daylight saving changes", then I am getting the date(from javscript) according to the Daylight savings time and if I uncheck it, I am getting the date according to the standard time. What I need is to get the date from a Javscript function irrespective of the Date&Time control of the control panel. Thanks Rupa.

    Read the article

  • How to determine whether there is date in the string or not with different date format ?

    - by Harikrishna
    I am parsing table information from the html table.Now I want to check whether there is date in the records for one particular column.Means I want to check whether there is date in the string or not .And date can be in different format like the string can be FUTIDX 26FEB2009 NIFTY 0 -- There is date in the string. FUTIDX MINIFTY 30 Jul 2009 -- There is date in the string. FUTSTK ONGC 27 Mar 2008 -- There is date in the string. How can I do that ?

    Read the article

  • R graphics plotting a linegraph with date/time horizontally along x-axis

    - by user2978586
    I want to get a linegraph in R which has Time along x and temperature along y. Originally I had the data in dd/mm/yyyy hh:mm format, with a time point every 30 minutes. https://www.dropbox.com/s/q35y1rfila0va1h/Data_logger_S65a_Ania.csv Since I couldn't find a way of reading this into R, I formatted the data to make it into dd/mm/yyyy and added a column 'time' with 1-48 for all the time points for each day https://www.dropbox.com/s/65ogxzyvuzteqxv/temp.csv This is what I have so far: temp<-read.csv("temp.csv",as.is=T) temp$date<-as.Date(temp$date, format="%d/%m/%Y") #inputting date in correct format plot(temperature ~ date, temp, type="n") #drawing a blank plot with axes, but without data lines(temp$date, temp$temperature,type="o") #type o is a line overlaid on top of points. This stacks the points up vertically, which is not what I want, and stacks all the time points (1-48) for each day all together on the same date. Any advice would be much appreciated on how to get this horizontal, and ordered by time as well as date.

    Read the article

  • What be the regex to determine whether there is date in the string or not with different date format

    - by Harikrishna
    I am parsing table information from the html table.Now I want to check whether there is date in the records for one particular column.Means I want to check whether there is date in the string or not .And date can be in different format like the string can be FUTIDX 26FEB2009 NIFTY 0 -- There is date in the string. FUTIDX MINIFTY 30 Jul 2009 -- There is date in the string. FUTSTK ONGC 27 Mar 2008 -- There is date in the string. What should be the regular expression for that ?

    Read the article

  • Customise date-time format in Windows.

    - by infant programmer
    Is it possible to customize data (or date-time) format in Windows [I am using windows XP]? The current format which is followed by the OS [to show date-modified, etc.] is MM/DD/YYYY or M/D/YYYY, whereas I have been comfortable with DD/MM/YYYY or D/M/YYYY format. I am finding it hard to refer Date-modified [which I use often] of files and folders.

    Read the article

  • [picker dismissModalViewControllerAnimated:YES]; not working

    - by shishir.bobby
    I am using - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { } for imagepicker and using [picker dismissModalViewControllerAnimated:YES]; in iPad to dismiss the picker. also i tried using - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker;{ [picker dismissModalViewControllerAnimated:YES]; } to dismiss the picker once it done the work. BUt its not dimissing it. when i tap anywhere in the screen, than only it gets dismiss. What i am doing wrong to dismiss the imagepicker? Many thnkas

    Read the article

  • YouTube Developers Live: Playlist Party Picker

    YouTube Developers Live: Playlist Party Picker Submit your questions here: goo.gl Danny Hermes, Jeff Posnick and JJ Behrens discuss how they built Party Playlist Picker, a Python App Engine application that lets Google+ users collaboratively edit YouTube Playlists. More details are at apiblog.youtube.com Helpful Links: OAuth2 for GData APIs - googleappsdeveloper.blogspot.com Channel API - developers.google.com Memcache - developers.google.com From: GoogleDevelopers Views: 141 18 ratings Time: 40:14 More in Science & Technology

    Read the article

  • Contact picker with search function

    - by tiex
    This question1 describes a way how to show list of phone numbers and select one of them if my app needs a phone number. But image if I have a huge contact list, it is not enough to just show list but possibility for filtering (by contact's name) is also needed. Is there a standard way to show phones list with picking possibility and with filtering possibility? (I wouldn't like to invent my own) Is there a solution for the problem for sdk 2.0 and lower?

    Read the article

  • Formating a table date field from the Model in Codeigniter

    - by Landitus
    Hi, I', trying to re-format a date from a table in Codeigniter. The Controller is for a blog. I was succesfull when the date conversion happens in the View. I was hoping to convert the date in the Model to have things in order. Here's the date conversion as it happens in the View. This is inside the posts loop: <?php foreach($records as $row) : ?> <?php $fdate = "%d <abbr>%M</abbr> %Y"; $dateConv = mdate($fdate, mysql_to_unix($row->date)); ?> <div class="article section"> <span class="date"><?php echo $dateConv ;?></span> ... Keeps going ... This is the Model: class Novedades_model extends Model { function getAll() { $this->db->order_by('date','desc'); $query = $this->db->get('novedades'); if($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[] = $row; } } return $data; } } How can I convert the date in the Model? Can I access the date key and refactor it?

    Read the article

  • Formating a date field in the Model (Codeigniter)

    - by Landitus
    Hi, I', trying to re-format a date from a table in Codeigniter. The Controller is for a blog. I was succesfull when the date conversion happens in the View. I was hoping to convert the date in the Model to have things in order. This is the Model: class Novedades_model extends Model { function getAll() { $this->db->order_by('date','desc'); $query = $this->db->get('novedades'); if($query->num_rows() > 0) { foreach ($query->result() as $row) { $data[] = $row; } } return $data; } } This is part of the controller $this->load->model('novedades_model'); $data['records'] = $this->novedades_model->getAll(); Here's the date conversion as it happens in the View. This is inside the posts loop: <?php foreach($records as $row) : ?> <?php $fdate = "%d <abbr>%M</abbr> %Y"; $dateConv = mdate($fdate, mysql_to_unix($row->date)); ?> <div class="article section"> <span class="date"><?php echo $dateConv ;?></span> ... Keeps going ... How can I convert the date in the Model? Can I access the date key and refactor it?

    Read the article

  • Problem getting weeks in a month with NSCalendar...

    - by AngrySpade
    I am creating a calendar control of sorts... One thing I need to know is how many weeks are there in a Month... So NSCalendar rangeOfUnit:inUnit:forDate Seems to be exactly what I need... Except I am noticing something that seems off and I can't quite figure out why this is happening... The following code... NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; [dateComponents setYear: 2010]; [dateComponents setDay: 1]; for (int x=1; x<=12; x++) { [dateComponents setMonth: x]; NSDate *date = [calendar dateFromComponents:dateComponents]; NSLog(@"Date: %@", date); NSRange range = [calendar rangeOfUnit: NSWeekCalendarUnit inUnit: NSMonthCalendarUnit forDate:date]; NSLog(@"%d Weeks in Month %d", range.length, [dateComponents month]); } Is returning the following debug messages... 2010-03-14 13:08:10.350 Scrap[4256:207] Date: 2010-01-01 00:00:00 -0500 2010-03-14 13:08:10.351 Scrap[4256:207] 5 Weeks in Month 1 2010-03-14 13:08:10.352 Scrap[4256:207] Date: 2010-02-01 00:00:00 -0500 2010-03-14 13:08:10.352 Scrap[4256:207] 4 Weeks in Month 2 2010-03-14 13:08:10.353 Scrap[4256:207] Date: 2010-03-01 00:00:00 -0500 2010-03-14 13:08:10.353 Scrap[4256:207] 5 Weeks in Month 3 2010-03-14 13:08:10.354 Scrap[4256:207] Date: 2010-04-01 00:00:00 -0400 2010-03-14 13:08:10.355 Scrap[4256:207] 5 Weeks in Month 4 2010-03-14 13:08:10.356 Scrap[4256:207] Date: 2010-05-01 00:00:00 -0400 2010-03-14 13:08:10.357 Scrap[4256:207] 5 Weeks in Month 5 2010-03-14 13:08:10.358 Scrap[4256:207] Date: 2010-06-01 00:00:00 -0400 2010-03-14 13:08:10.358 Scrap[4256:207] 5 Weeks in Month 6 2010-03-14 13:08:10.359 Scrap[4256:207] Date: 2010-07-01 00:00:00 -0400 2010-03-14 13:08:10.360 Scrap[4256:207] 5 Weeks in Month 7 2010-03-14 13:08:10.361 Scrap[4256:207] Date: 2010-08-01 00:00:00 -0400 2010-03-14 13:08:10.364 Scrap[4256:207] 5 Weeks in Month 8 2010-03-14 13:08:10.364 Scrap[4256:207] Date: 2010-09-01 00:00:00 -0400 2010-03-14 13:08:10.365 Scrap[4256:207] 5 Weeks in Month 9 2010-03-14 13:08:10.366 Scrap[4256:207] Date: 2010-10-01 00:00:00 -0400 2010-03-14 13:08:10.366 Scrap[4256:207] 5 Weeks in Month 10 2010-03-14 13:08:10.367 Scrap[4256:207] Date: 2010-11-01 00:00:00 -0400 2010-03-14 13:08:10.367 Scrap[4256:207] 5 Weeks in Month 11 2010-03-14 13:08:10.369 Scrap[4256:207] Date: 2010-12-01 00:00:00 -0500 2010-03-14 13:08:10.369 Scrap[4256:207] 52 Weeks in Month 12 I cant quite figure out why I get 52 weeks in month 12. Any clues? Edit on 3/20/2010: Seeing as how I couldnt use rangeOfUnit:inUnit:forDate to calculate the number of weeks in a month. I decided to figure out a different way of calculating the same value. I figured I should do this in a non-Gregorian localized way, so I attempted to start with getting the number of days in a week, but I got the result of 28 days in a week. So I started writing more code to figure out why... I wanted to make sure that the type of NSCalendar that I was playing with was in fact what I was supposed to be getting... And that led me to finding some differences... NSCalendar *currentCalendar = [NSCalendar currentCalendar]; NSLog(@"Calendar with 'currentCalendar' Identifier: %@", [currentCalendar calendarIdentifier]); NSCalendar *calendarWithIdentifier = [[[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar] autorelease]; NSLog(@"Calendar created with identifier Identifier: %@", [calendarWithIdentifier calendarIdentifier]); NSDate *now = [[NSDate alloc] init]; NSDateComponents *currentMonth = [currentCalendar components: NSMonthCalendarUnit | NSYearCalendarUnit fromDate: now]; NSDate *currentMonthDate = [currentCalendar dateFromComponents: currentMonth]; NSRange daysInWeekRange = [currentCalendar rangeOfUnit: NSDayCalendarUnit inUnit: NSWeekCalendarUnit forDate: currentMonthDate]; NSLog(@"CurrentCalendar: Length:%u Location:%u", daysInWeekRange.length, daysInWeekRange.location); currentMonth = [calendarWithIdentifier components: NSMonthCalendarUnit | NSYearCalendarUnit fromDate: now]; currentMonthDate = [calendarWithIdentifier dateFromComponents: currentMonth]; daysInWeekRange = [calendarWithIdentifier rangeOfUnit: NSDayCalendarUnit inUnit: NSWeekCalendarUnit forDate: currentMonthDate]; NSLog(@"GregorianCalendar: Length:%u Location:%u", daysInWeekRange.length, daysInWeekRange.location); And that got me the following log results... 2010-03-20 21:02:27.245 Scrap[52189:207] Calendar with 'currentCalendar' Identifier: gregorian 2010-03-20 21:02:27.246 Scrap[52189:207] Calendar created with identifier Identifier: gregorian 2010-03-20 21:02:27.248 Scrap[52189:207] CurrentCalendar: Length:28 Location:1 2010-03-20 21:02:27.249 Scrap[52189:207] GregorianCalendar: Length:7 Location:1 Taking direction from @CarlNorum's experience, I compiled the code snippet as a 10.6 Cocoa application, and I got the following... 2010-03-20 21:05:35.636 ScrapCocoa[52238:a0f] Calendar with 'currentCalendar' Identifier: gregorian 2010-03-20 21:05:35.636 ScrapCocoa[52238:a0f] Calendar created with identifier Identifier: gregorian 2010-03-20 21:05:35.637 ScrapCocoa[52238:a0f] CurrentCalendar: Length:6 Location:1 2010-03-20 21:05:35.638 ScrapCocoa[52238:a0f] GregorianCalendar: Length:7 Location:1 I saw hope in that creating a NSCalendar Instance explicitly as a Gregorian Calendar would lead to better results in my original problem... So I modified that original code NSCalendar *currentCalendar = [NSCalendar currentCalendar]; NSLog(@"Calendar with 'currentCalendar' Identifier: %@", [currentCalendar calendarIdentifier]); NSCalendar *calendarWithIdentifier = [[[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar] autorelease]; NSLog(@"Calendar created with identifier Identifier: %@", [calendarWithIdentifier calendarIdentifier]); NSDateComponents *dateComponents = [[[NSDateComponents alloc] init] autorelease]; [dateComponents setYear: 2010]; [dateComponents setDay: 1]; for (int x=1; x<=12; x++) { [dateComponents setMonth: x]; NSDate *date = [currentCalendar dateFromComponents: dateComponents]; NSRange range = [currentCalendar rangeOfUnit: NSWeekCalendarUnit inUnit: NSMonthCalendarUnit forDate: date]; NSLog(@"CurrentCalendar Date: %@", date); NSLog(@"CurrentCalendar: %d Weeks in Month %d", range.length, [dateComponents month]); date = [calendarWithIdentifier dateFromComponents: dateComponents]; range = [calendarWithIdentifier rangeOfUnit: NSWeekCalendarUnit inUnit: NSMonthCalendarUnit forDate: date]; NSLog(@"GregorianCalendar Date: %@", date); NSLog(@"GregorianCalendar: %d Weeks in Month %d", range.length, [dateComponents month]); } Unfortunately using a calendar created that way did not return a different result. 2010-03-20 21:15:40.465 Scrap[52367:207] Calendar with 'currentCalendar' Identifier: gregorian 2010-03-20 21:15:40.466 Scrap[52367:207] Calendar created with identifier Identifier: gregorian 2010-03-20 21:15:40.468 Scrap[52367:207] CurrentCalendar Date: 2010-01-01 00:00:00 -0500 2010-03-20 21:15:40.468 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 1 2010-03-20 21:15:40.469 Scrap[52367:207] GregorianCalendar Date: 2010-01-01 00:00:00 -0500 2010-03-20 21:15:40.470 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 1 2010-03-20 21:15:40.471 Scrap[52367:207] CurrentCalendar Date: 2010-02-01 00:00:00 -0500 2010-03-20 21:15:40.471 Scrap[52367:207] CurrentCalendar: 4 Weeks in Month 2 2010-03-20 21:15:40.472 Scrap[52367:207] GregorianCalendar Date: 2010-02-01 00:00:00 -0500 2010-03-20 21:15:40.473 Scrap[52367:207] GregorianCalendar: 4 Weeks in Month 2 2010-03-20 21:15:40.473 Scrap[52367:207] CurrentCalendar Date: 2010-03-01 00:00:00 -0500 2010-03-20 21:15:40.474 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 3 2010-03-20 21:15:40.475 Scrap[52367:207] GregorianCalendar Date: 2010-03-01 00:00:00 -0500 2010-03-20 21:15:40.475 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 3 2010-03-20 21:15:40.476 Scrap[52367:207] CurrentCalendar Date: 2010-04-01 00:00:00 -0400 2010-03-20 21:15:40.477 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 4 2010-03-20 21:15:40.478 Scrap[52367:207] GregorianCalendar Date: 2010-04-01 00:00:00 -0400 2010-03-20 21:15:40.479 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 4 2010-03-20 21:15:40.480 Scrap[52367:207] CurrentCalendar Date: 2010-05-01 00:00:00 -0400 2010-03-20 21:15:40.480 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 5 2010-03-20 21:15:40.482 Scrap[52367:207] GregorianCalendar Date: 2010-05-01 00:00:00 -0400 2010-03-20 21:15:40.482 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 5 2010-03-20 21:15:40.483 Scrap[52367:207] CurrentCalendar Date: 2010-06-01 00:00:00 -0400 2010-03-20 21:15:40.483 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 6 2010-03-20 21:15:40.484 Scrap[52367:207] GregorianCalendar Date: 2010-06-01 00:00:00 -0400 2010-03-20 21:15:40.485 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 6 2010-03-20 21:15:40.485 Scrap[52367:207] CurrentCalendar Date: 2010-07-01 00:00:00 -0400 2010-03-20 21:15:40.486 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 7 2010-03-20 21:15:40.486 Scrap[52367:207] GregorianCalendar Date: 2010-07-01 00:00:00 -0400 2010-03-20 21:15:40.487 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 7 2010-03-20 21:15:40.488 Scrap[52367:207] CurrentCalendar Date: 2010-08-01 00:00:00 -0400 2010-03-20 21:15:40.488 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 8 2010-03-20 21:15:40.489 Scrap[52367:207] GregorianCalendar Date: 2010-08-01 00:00:00 -0400 2010-03-20 21:15:40.489 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 8 2010-03-20 21:15:40.490 Scrap[52367:207] CurrentCalendar Date: 2010-09-01 00:00:00 -0400 2010-03-20 21:15:40.491 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 9 2010-03-20 21:15:40.491 Scrap[52367:207] GregorianCalendar Date: 2010-09-01 00:00:00 -0400 2010-03-20 21:15:40.492 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 9 2010-03-20 21:15:40.493 Scrap[52367:207] CurrentCalendar Date: 2010-10-01 00:00:00 -0400 2010-03-20 21:15:40.493 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 10 2010-03-20 21:15:40.494 Scrap[52367:207] GregorianCalendar Date: 2010-10-01 00:00:00 -0400 2010-03-20 21:15:40.494 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 10 2010-03-20 21:15:40.495 Scrap[52367:207] CurrentCalendar Date: 2010-11-01 00:00:00 -0400 2010-03-20 21:15:40.496 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 11 2010-03-20 21:15:40.496 Scrap[52367:207] GregorianCalendar Date: 2010-11-01 00:00:00 -0400 2010-03-20 21:15:40.497 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 11 2010-03-20 21:15:40.498 Scrap[52367:207] CurrentCalendar Date: 2010-12-01 00:00:00 -0500 2010-03-20 21:15:40.498 Scrap[52367:207] CurrentCalendar: 52 Weeks in Month 12 2010-03-20 21:15:40.499 Scrap[52367:207] GregorianCalendar Date: 2010-12-01 00:00:00 -0500 2010-03-20 21:15:40.500 Scrap[52367:207] GregorianCalendar: 52 Weeks in Month 12 Compiling the code for Cocoa just for kicks, was actually amusing... As the results are really really different 2010-03-20 21:11:24.610 ScrapCocoa[52313:a0f] Calendar with 'currentCalendar' Identifier: gregorian 2010-03-20 21:11:24.611 ScrapCocoa[52313:a0f] Calendar created with identifier Identifier: gregorian 2010-03-20 21:11:24.613 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-01-01 00:00:00 -0500 2010-03-20 21:11:24.613 ScrapCocoa[52313:a0f] CurrentCalendar: 6 Weeks in Month 1 2010-03-20 21:11:24.614 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-01-01 00:00:00 -0500 2010-03-20 21:11:24.615 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 1 2010-03-20 21:11:24.616 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-02-01 00:00:00 -0500 2010-03-20 21:11:24.616 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 2 2010-03-20 21:11:24.617 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-02-01 00:00:00 -0500 2010-03-20 21:11:24.618 ScrapCocoa[52313:a0f] GregorianCalendar: 4 Weeks in Month 2 2010-03-20 21:11:24.619 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-03-01 00:00:00 -0500 2010-03-20 21:11:24.619 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 3 2010-03-20 21:11:24.620 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-03-01 00:00:00 -0500 2010-03-20 21:11:24.621 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 3 2010-03-20 21:11:24.622 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-04-01 00:00:00 -0400 2010-03-20 21:11:24.622 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 4 2010-03-20 21:11:24.623 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-04-01 00:00:00 -0400 2010-03-20 21:11:24.623 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 4 2010-03-20 21:11:24.624 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-05-01 00:00:00 -0400 2010-03-20 21:11:24.625 ScrapCocoa[52313:a0f] CurrentCalendar: 6 Weeks in Month 5 2010-03-20 21:11:24.625 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-05-01 00:00:00 -0400 2010-03-20 21:11:24.626 ScrapCocoa[52313:a0f] GregorianCalendar: 6 Weeks in Month 5 2010-03-20 21:11:24.627 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-06-01 00:00:00 -0400 2010-03-20 21:11:24.627 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 6 2010-03-20 21:11:24.628 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-06-01 00:00:00 -0400 2010-03-20 21:11:24.628 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 6 2010-03-20 21:11:24.629 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-07-01 00:00:00 -0400 2010-03-20 21:11:24.630 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 7 2010-03-20 21:11:24.630 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-07-01 00:00:00 -0400 2010-03-20 21:11:24.631 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 7 2010-03-20 21:11:24.632 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-08-01 00:00:00 -0400 2010-03-20 21:11:24.632 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 8 2010-03-20 21:11:24.633 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-08-01 00:00:00 -0400 2010-03-20 21:11:24.633 ScrapCocoa[52313:a0f] GregorianCalendar: 6 Weeks in Month 8 2010-03-20 21:11:24.634 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-09-01 00:00:00 -0400 2010-03-20 21:11:24.635 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 9 2010-03-20 21:11:24.636 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-09-01 00:00:00 -0400 2010-03-20 21:11:24.636 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 9 2010-03-20 21:11:24.637 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-10-01 00:00:00 -0400 2010-03-20 21:11:24.637 ScrapCocoa[52313:a0f] CurrentCalendar: 6 Weeks in Month 10 2010-03-20 21:11:24.638 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-10-01 00:00:00 -0400 2010-03-20 21:11:24.639 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 10 2010-03-20 21:11:24.640 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-11-01 00:00:00 -0400 2010-03-20 21:11:24.640 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 11 2010-03-20 21:11:24.641 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-11-01 00:00:00 -0400 2010-03-20 21:11:24.641 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 11 2010-03-20 21:11:24.642 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-12-01 00:00:00 -0500 2010-03-20 21:11:24.642 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 12 2010-03-20 21:11:24.643 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-12-01 00:00:00 -0500 2010-03-20 21:11:24.644 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 12 I think this is when I give up...

    Read the article

  • Problem getting weeks in a month...

    - by AngrySpade
    I am creating a calendar control of sorts... One thing I need to know is how many weeks are there in a Month... So NSCalendar rangeOfUnit:inUnit:forDate Seems to be exactly what I need... Except I am noticing something that seems off and I can't quite figure out why this is happening... The following code... NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; [dateComponents setYear: 2010]; [dateComponents setDay: 1]; for (int x=1; x<=12; x++) { [dateComponents setMonth: x]; NSDate *date = [calendar dateFromComponents:dateComponents]; NSLog(@"Date: %@", date); NSRange range = [calendar rangeOfUnit: NSWeekCalendarUnit inUnit: NSMonthCalendarUnit forDate:date]; NSLog(@"%d Weeks in Month %d", range.length, [dateComponents month]); } Is returning the following debug messages... 2010-03-14 13:08:10.350 Scrap[4256:207] Date: 2010-01-01 00:00:00 -0500 2010-03-14 13:08:10.351 Scrap[4256:207] 5 Weeks in Month 1 2010-03-14 13:08:10.352 Scrap[4256:207] Date: 2010-02-01 00:00:00 -0500 2010-03-14 13:08:10.352 Scrap[4256:207] 4 Weeks in Month 2 2010-03-14 13:08:10.353 Scrap[4256:207] Date: 2010-03-01 00:00:00 -0500 2010-03-14 13:08:10.353 Scrap[4256:207] 5 Weeks in Month 3 2010-03-14 13:08:10.354 Scrap[4256:207] Date: 2010-04-01 00:00:00 -0400 2010-03-14 13:08:10.355 Scrap[4256:207] 5 Weeks in Month 4 2010-03-14 13:08:10.356 Scrap[4256:207] Date: 2010-05-01 00:00:00 -0400 2010-03-14 13:08:10.357 Scrap[4256:207] 5 Weeks in Month 5 2010-03-14 13:08:10.358 Scrap[4256:207] Date: 2010-06-01 00:00:00 -0400 2010-03-14 13:08:10.358 Scrap[4256:207] 5 Weeks in Month 6 2010-03-14 13:08:10.359 Scrap[4256:207] Date: 2010-07-01 00:00:00 -0400 2010-03-14 13:08:10.360 Scrap[4256:207] 5 Weeks in Month 7 2010-03-14 13:08:10.361 Scrap[4256:207] Date: 2010-08-01 00:00:00 -0400 2010-03-14 13:08:10.364 Scrap[4256:207] 5 Weeks in Month 8 2010-03-14 13:08:10.364 Scrap[4256:207] Date: 2010-09-01 00:00:00 -0400 2010-03-14 13:08:10.365 Scrap[4256:207] 5 Weeks in Month 9 2010-03-14 13:08:10.366 Scrap[4256:207] Date: 2010-10-01 00:00:00 -0400 2010-03-14 13:08:10.366 Scrap[4256:207] 5 Weeks in Month 10 2010-03-14 13:08:10.367 Scrap[4256:207] Date: 2010-11-01 00:00:00 -0400 2010-03-14 13:08:10.367 Scrap[4256:207] 5 Weeks in Month 11 2010-03-14 13:08:10.369 Scrap[4256:207] Date: 2010-12-01 00:00:00 -0500 2010-03-14 13:08:10.369 Scrap[4256:207] 52 Weeks in Month 12 I cant quite figure out why I get 52 weeks in month 12. Any clues? Edit on 3/20/2010: Seeing as how I couldnt use rangeOfUnit:inUnit:forDate to calculate the number of weeks in a month. I decided to figure out a different way of calculating the same value. I figured I should do this in a non-Gregorian localized way, so I attempted to start with getting the number of days in a week, but I got the result of 28 days in a week. So I started writing more code to figure out why... I wanted to make sure that the type of NSCalendar that I was playing with was in fact what I was supposed to be getting... And that led me to finding some differences... NSCalendar *currentCalendar = [NSCalendar currentCalendar]; NSLog(@"Calendar with 'currentCalendar' Identifier: %@", [currentCalendar calendarIdentifier]); NSCalendar *calendarWithIdentifier = [[[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar] autorelease]; NSLog(@"Calendar created with identifier Identifier: %@", [calendarWithIdentifier calendarIdentifier]); NSDate *now = [[NSDate alloc] init]; NSDateComponents *currentMonth = [currentCalendar components: NSMonthCalendarUnit | NSYearCalendarUnit fromDate: now]; NSDate *currentMonthDate = [currentCalendar dateFromComponents: currentMonth]; NSRange daysInWeekRange = [currentCalendar rangeOfUnit: NSDayCalendarUnit inUnit: NSWeekCalendarUnit forDate: currentMonthDate]; NSLog(@"CurrentCalendar: Length:%u Location:%u", daysInWeekRange.length, daysInWeekRange.location); currentMonth = [calendarWithIdentifier components: NSMonthCalendarUnit | NSYearCalendarUnit fromDate: now]; currentMonthDate = [calendarWithIdentifier dateFromComponents: currentMonth]; daysInWeekRange = [calendarWithIdentifier rangeOfUnit: NSDayCalendarUnit inUnit: NSWeekCalendarUnit forDate: currentMonthDate]; NSLog(@"GregorianCalendar: Length:%u Location:%u", daysInWeekRange.length, daysInWeekRange.location); And that got me the following log results... 2010-03-20 21:02:27.245 Scrap[52189:207] Calendar with 'currentCalendar' Identifier: gregorian 2010-03-20 21:02:27.246 Scrap[52189:207] Calendar created with identifier Identifier: gregorian 2010-03-20 21:02:27.248 Scrap[52189:207] CurrentCalendar: Length:28 Location:1 2010-03-20 21:02:27.249 Scrap[52189:207] GregorianCalendar: Length:7 Location:1 Taking direction from @CarlNorum's experience, I compiled the code snippet as a 10.6 Cocoa application, and I got the following... 2010-03-20 21:05:35.636 ScrapCocoa[52238:a0f] Calendar with 'currentCalendar' Identifier: gregorian 2010-03-20 21:05:35.636 ScrapCocoa[52238:a0f] Calendar created with identifier Identifier: gregorian 2010-03-20 21:05:35.637 ScrapCocoa[52238:a0f] CurrentCalendar: Length:6 Location:1 2010-03-20 21:05:35.638 ScrapCocoa[52238:a0f] GregorianCalendar: Length:7 Location:1 I saw hope in that creating a NSCalendar Instance explicitly as a Gregorian Calendar would lead to better results in my original problem... So I modified that original code NSCalendar *currentCalendar = [NSCalendar currentCalendar]; NSLog(@"Calendar with 'currentCalendar' Identifier: %@", [currentCalendar calendarIdentifier]); NSCalendar *calendarWithIdentifier = [[[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar] autorelease]; NSLog(@"Calendar created with identifier Identifier: %@", [calendarWithIdentifier calendarIdentifier]); NSDateComponents *dateComponents = [[[NSDateComponents alloc] init] autorelease]; [dateComponents setYear: 2010]; [dateComponents setDay: 1]; for (int x=1; x<=12; x++) { [dateComponents setMonth: x]; NSDate *date = [currentCalendar dateFromComponents: dateComponents]; NSRange range = [currentCalendar rangeOfUnit: NSWeekCalendarUnit inUnit: NSMonthCalendarUnit forDate: date]; NSLog(@"CurrentCalendar Date: %@", date); NSLog(@"CurrentCalendar: %d Weeks in Month %d", range.length, [dateComponents month]); date = [calendarWithIdentifier dateFromComponents: dateComponents]; range = [calendarWithIdentifier rangeOfUnit: NSWeekCalendarUnit inUnit: NSMonthCalendarUnit forDate: date]; NSLog(@"GregorianCalendar Date: %@", date); NSLog(@"GregorianCalendar: %d Weeks in Month %d", range.length, [dateComponents month]); } Unfortunately using a calendar created that way did not return a different result. 2010-03-20 21:15:40.465 Scrap[52367:207] Calendar with 'currentCalendar' Identifier: gregorian 2010-03-20 21:15:40.466 Scrap[52367:207] Calendar created with identifier Identifier: gregorian 2010-03-20 21:15:40.468 Scrap[52367:207] CurrentCalendar Date: 2010-01-01 00:00:00 -0500 2010-03-20 21:15:40.468 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 1 2010-03-20 21:15:40.469 Scrap[52367:207] GregorianCalendar Date: 2010-01-01 00:00:00 -0500 2010-03-20 21:15:40.470 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 1 2010-03-20 21:15:40.471 Scrap[52367:207] CurrentCalendar Date: 2010-02-01 00:00:00 -0500 2010-03-20 21:15:40.471 Scrap[52367:207] CurrentCalendar: 4 Weeks in Month 2 2010-03-20 21:15:40.472 Scrap[52367:207] GregorianCalendar Date: 2010-02-01 00:00:00 -0500 2010-03-20 21:15:40.473 Scrap[52367:207] GregorianCalendar: 4 Weeks in Month 2 2010-03-20 21:15:40.473 Scrap[52367:207] CurrentCalendar Date: 2010-03-01 00:00:00 -0500 2010-03-20 21:15:40.474 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 3 2010-03-20 21:15:40.475 Scrap[52367:207] GregorianCalendar Date: 2010-03-01 00:00:00 -0500 2010-03-20 21:15:40.475 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 3 2010-03-20 21:15:40.476 Scrap[52367:207] CurrentCalendar Date: 2010-04-01 00:00:00 -0400 2010-03-20 21:15:40.477 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 4 2010-03-20 21:15:40.478 Scrap[52367:207] GregorianCalendar Date: 2010-04-01 00:00:00 -0400 2010-03-20 21:15:40.479 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 4 2010-03-20 21:15:40.480 Scrap[52367:207] CurrentCalendar Date: 2010-05-01 00:00:00 -0400 2010-03-20 21:15:40.480 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 5 2010-03-20 21:15:40.482 Scrap[52367:207] GregorianCalendar Date: 2010-05-01 00:00:00 -0400 2010-03-20 21:15:40.482 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 5 2010-03-20 21:15:40.483 Scrap[52367:207] CurrentCalendar Date: 2010-06-01 00:00:00 -0400 2010-03-20 21:15:40.483 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 6 2010-03-20 21:15:40.484 Scrap[52367:207] GregorianCalendar Date: 2010-06-01 00:00:00 -0400 2010-03-20 21:15:40.485 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 6 2010-03-20 21:15:40.485 Scrap[52367:207] CurrentCalendar Date: 2010-07-01 00:00:00 -0400 2010-03-20 21:15:40.486 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 7 2010-03-20 21:15:40.486 Scrap[52367:207] GregorianCalendar Date: 2010-07-01 00:00:00 -0400 2010-03-20 21:15:40.487 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 7 2010-03-20 21:15:40.488 Scrap[52367:207] CurrentCalendar Date: 2010-08-01 00:00:00 -0400 2010-03-20 21:15:40.488 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 8 2010-03-20 21:15:40.489 Scrap[52367:207] GregorianCalendar Date: 2010-08-01 00:00:00 -0400 2010-03-20 21:15:40.489 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 8 2010-03-20 21:15:40.490 Scrap[52367:207] CurrentCalendar Date: 2010-09-01 00:00:00 -0400 2010-03-20 21:15:40.491 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 9 2010-03-20 21:15:40.491 Scrap[52367:207] GregorianCalendar Date: 2010-09-01 00:00:00 -0400 2010-03-20 21:15:40.492 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 9 2010-03-20 21:15:40.493 Scrap[52367:207] CurrentCalendar Date: 2010-10-01 00:00:00 -0400 2010-03-20 21:15:40.493 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 10 2010-03-20 21:15:40.494 Scrap[52367:207] GregorianCalendar Date: 2010-10-01 00:00:00 -0400 2010-03-20 21:15:40.494 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 10 2010-03-20 21:15:40.495 Scrap[52367:207] CurrentCalendar Date: 2010-11-01 00:00:00 -0400 2010-03-20 21:15:40.496 Scrap[52367:207] CurrentCalendar: 5 Weeks in Month 11 2010-03-20 21:15:40.496 Scrap[52367:207] GregorianCalendar Date: 2010-11-01 00:00:00 -0400 2010-03-20 21:15:40.497 Scrap[52367:207] GregorianCalendar: 5 Weeks in Month 11 2010-03-20 21:15:40.498 Scrap[52367:207] CurrentCalendar Date: 2010-12-01 00:00:00 -0500 2010-03-20 21:15:40.498 Scrap[52367:207] CurrentCalendar: 52 Weeks in Month 12 2010-03-20 21:15:40.499 Scrap[52367:207] GregorianCalendar Date: 2010-12-01 00:00:00 -0500 2010-03-20 21:15:40.500 Scrap[52367:207] GregorianCalendar: 52 Weeks in Month 12 Compiling the code for Cocoa just for kicks, was actually amusing... As the results are really really different 2010-03-20 21:11:24.610 ScrapCocoa[52313:a0f] Calendar with 'currentCalendar' Identifier: gregorian 2010-03-20 21:11:24.611 ScrapCocoa[52313:a0f] Calendar created with identifier Identifier: gregorian 2010-03-20 21:11:24.613 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-01-01 00:00:00 -0500 2010-03-20 21:11:24.613 ScrapCocoa[52313:a0f] CurrentCalendar: 6 Weeks in Month 1 2010-03-20 21:11:24.614 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-01-01 00:00:00 -0500 2010-03-20 21:11:24.615 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 1 2010-03-20 21:11:24.616 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-02-01 00:00:00 -0500 2010-03-20 21:11:24.616 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 2 2010-03-20 21:11:24.617 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-02-01 00:00:00 -0500 2010-03-20 21:11:24.618 ScrapCocoa[52313:a0f] GregorianCalendar: 4 Weeks in Month 2 2010-03-20 21:11:24.619 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-03-01 00:00:00 -0500 2010-03-20 21:11:24.619 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 3 2010-03-20 21:11:24.620 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-03-01 00:00:00 -0500 2010-03-20 21:11:24.621 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 3 2010-03-20 21:11:24.622 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-04-01 00:00:00 -0400 2010-03-20 21:11:24.622 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 4 2010-03-20 21:11:24.623 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-04-01 00:00:00 -0400 2010-03-20 21:11:24.623 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 4 2010-03-20 21:11:24.624 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-05-01 00:00:00 -0400 2010-03-20 21:11:24.625 ScrapCocoa[52313:a0f] CurrentCalendar: 6 Weeks in Month 5 2010-03-20 21:11:24.625 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-05-01 00:00:00 -0400 2010-03-20 21:11:24.626 ScrapCocoa[52313:a0f] GregorianCalendar: 6 Weeks in Month 5 2010-03-20 21:11:24.627 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-06-01 00:00:00 -0400 2010-03-20 21:11:24.627 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 6 2010-03-20 21:11:24.628 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-06-01 00:00:00 -0400 2010-03-20 21:11:24.628 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 6 2010-03-20 21:11:24.629 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-07-01 00:00:00 -0400 2010-03-20 21:11:24.630 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 7 2010-03-20 21:11:24.630 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-07-01 00:00:00 -0400 2010-03-20 21:11:24.631 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 7 2010-03-20 21:11:24.632 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-08-01 00:00:00 -0400 2010-03-20 21:11:24.632 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 8 2010-03-20 21:11:24.633 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-08-01 00:00:00 -0400 2010-03-20 21:11:24.633 ScrapCocoa[52313:a0f] GregorianCalendar: 6 Weeks in Month 8 2010-03-20 21:11:24.634 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-09-01 00:00:00 -0400 2010-03-20 21:11:24.635 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 9 2010-03-20 21:11:24.636 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-09-01 00:00:00 -0400 2010-03-20 21:11:24.636 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 9 2010-03-20 21:11:24.637 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-10-01 00:00:00 -0400 2010-03-20 21:11:24.637 ScrapCocoa[52313:a0f] CurrentCalendar: 6 Weeks in Month 10 2010-03-20 21:11:24.638 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-10-01 00:00:00 -0400 2010-03-20 21:11:24.639 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 10 2010-03-20 21:11:24.640 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-11-01 00:00:00 -0400 2010-03-20 21:11:24.640 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 11 2010-03-20 21:11:24.641 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-11-01 00:00:00 -0400 2010-03-20 21:11:24.641 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 11 2010-03-20 21:11:24.642 ScrapCocoa[52313:a0f] CurrentCalendar Date: 2010-12-01 00:00:00 -0500 2010-03-20 21:11:24.642 ScrapCocoa[52313:a0f] CurrentCalendar: 5 Weeks in Month 12 2010-03-20 21:11:24.643 ScrapCocoa[52313:a0f] GregorianCalendar Date: 2010-12-01 00:00:00 -0500 2010-03-20 21:11:24.644 ScrapCocoa[52313:a0f] GregorianCalendar: 5 Weeks in Month 12 I think this is when I give up...

    Read the article

  • Need help in filtering the data with various condition and filling in scroll window GP

    - by Rahul
    Hi all, I am filtering the data and displaying in scroll window. There are many combination to display this data by customer id, customer id and itemnumber, customer id, itemnumber, work and history condition. And from date and To date condition. My query is when I am selecting the customer id and work or history table it should display the corresponding data. Like select * from price history where customerid=’custid’ and name=’Work’. It should display in scroll only these values none other it the same way history condition should work. Work and History are in check box. In my case whatever range I am selecting whether Work and History always loading with entire data, so it’s not filtering properly. My second problem is if I select from date and keep empty to date …in this case all the data should display from selected from date to end of table data. But I am not getting….pls somebody help me here is my entire coding: if empty('Customer Number') then warning "Select Customer ID"; focus 'Customer Number'; abort script; end if; if '(L) RadioGroup4' of window Window1 of form 'Customer Pricing Inquiry'=1 then if empty(Date) then abort script; focus Date; end if; end if; if not empty('(L) Date') then if '(L) Date' {if not empty(Date) and empty('(L) Date') then warning"Please enter To Date"; focus field '(L) Date'; abort script; end if;} range clear table Display_Pricing_Temp; clear field 'Customer Number' of table Display_Pricing_Temp; range start table Display_Pricing_Temp; fill field 'Customer Number' of table Display_Pricing_Temp; range end table Display_Pricing_Temp; remove range table Display_Pricing_Temp; range clear table Display_Pricing; if '(L) Checkbox0' =true and '(L) Checkbox2'=true and empty('Item Code' of window Window1 of form 'Customer Pricing Inquiry') and str(Date of window Window1 of form 'Customer Pricing Inquiry')="0/0/0000" then {range clear table Display_Pricing;} range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and ("+ physicalname(Name of table Display_Pricing)+ "='History' or "+ physicalname(Name of table Display_Pricing)+ "='Work')"; {range clear table Display_Pricing;} end if; if '(L) Checkbox0' =true or '(L) Checkbox2'=true then {{Only Item No is there} if not empty('Item Code') and '(L) Checkbox0' =false and '(L) Checkbox2'=false and str('(L) Date')="0/0/0000" then range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"'"; end if; } if empty('(L) Date') and not empty(Date) then {date work hist item} if not empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=true and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and ("+ physicalname(Name of table Display_Pricing)+ "='Work' or " +physicalname(Name of table Display_Pricing)+ "='History')and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102)" ; range clear table Display_Pricing; end if; {date work hist } if empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=true and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and ("+ physicalname(Name of table Display_Pricing)+ "='Work' or " +physicalname(Name of table Display_Pricing)+ "='History')and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102)" ; range clear table Display_Pricing; end if; {date,work,item code} if not empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=false and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and "+ physicalname(Name of table Display_Pricing)+ "='Work' and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102)" ; range clear table Display_Pricing; end if; {date history item code} if not empty('Item Code') and '(L) Checkbox0' =false and '(L) Checkbox2'=true and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and "+ physicalname(Name of table Display_Pricing)+ "='History' and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102)" ; range clear table Display_Pricing; end if; {date,work} if empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=false and not empty(Date) then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname(Name of table Display_Pricing)+ "='Work' and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102) "; range clear table Display_Pricing; end if; {date history } if empty('Item Code') and '(L) Checkbox0' =false and '(L) Checkbox2'=true and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname(Name of table Display_Pricing)+ "='History' and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102)" ; range clear table Display_Pricing; end if; end if; if not empty('(L) Date') and not empty(Date) then {Only Item No is there and work} if not empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=false and str(Date)="0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and "+ physicalname(Name of table Display_Pricing)+ "='Work'"; range clear table Display_Pricing; end if; if not empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=true and str(Date)="0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and ("+ physicalname(Name of table Display_Pricing)+ "='Work' or " +physicalname(Name of table Display_Pricing)+ "='History')"; range clear table Display_Pricing; end if; {date work hist item} if not empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=true and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and ("+ physicalname(Name of table Display_Pricing)+ "='Work' or " +physicalname(Name of table Display_Pricing)+ "='History')and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) between convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102) and convert(datetime,convert(varchar(20),'"+ str('(L) Date' of window Window1 of form 'Customer Pricing Inquiry') +"'),102)"; range clear table Display_Pricing; end if; {date work hist } if empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=true and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and ("+ physicalname(Name of table Display_Pricing)+ "='Work' or " +physicalname(Name of table Display_Pricing)+ "='History')and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) between convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102) and convert(datetime,convert(varchar(20),'"+ str('(L) Date' of window Window1 of form 'Customer Pricing Inquiry') +"'),102)"; range clear table Display_Pricing; end if; {date,work,item code} if not empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=false and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and "+ physicalname(Name of table Display_Pricing)+ "='Work' and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) between convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102) and convert(datetime,convert(varchar(20),'"+ str('(L) Date' of window Window1 of form 'Customer Pricing Inquiry') +"'),102)"; range clear table Display_Pricing; end if; {date history item code} if not empty('Item Code') and '(L) Checkbox0' =false and '(L) Checkbox2'=true and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and "+ physicalname(Name of table Display_Pricing)+ "='History' and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) between convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102) and convert(datetime,convert(varchar(20),'"+ str('(L) Date' of window Window1 of form 'Customer Pricing Inquiry') +"'),102)"; range clear table Display_Pricing; end if; {date work} {date,work} if empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=false and not empty(Date) then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname(Name of table Display_Pricing)+ "='Work' and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) between convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102) and convert(datetime,convert(varchar(20),'"+ str('(L) Date' of window Window1 of form 'Customer Pricing Inquiry') +"'),102)"; range clear table Display_Pricing; end if; {date history } if empty('Item Code') and '(L) Checkbox0' =false and '(L) Checkbox2'=true and str(Date)<"0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname(Name of table Display_Pricing)+ "='History' and convert(datetime,convert(varchar(20)," +physicalname(Date of table Display_Pricing)+"),102) between convert(datetime,convert(varchar(20),'"+ str(Date of window Window1 of form 'Customer Pricing Inquiry')+ "'),102) and convert(datetime,convert(varchar(20),'"+ str('(L) Date' of window Window1 of form 'Customer Pricing Inquiry') +"'),102)"; range clear table Display_Pricing; end if; end if; {Only Item No is there and hist} if not empty('Item Code') and '(L) Checkbox0' =false and '(L) Checkbox2'=true and str(Date)="0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname('Item Number' of table Display_Pricing)+ "='"+ str('Item Code')+"' and "+ physicalname(Name of table Display_Pricing)+ "='History'"; range clear table Display_Pricing; end if; {for only work table } if empty('Item Code') and '(L) Checkbox0' =true and '(L) Checkbox2'=false and str(Date)="0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname(Name of table Display_Pricing)+ "='Work'"; range clear table Display_Pricing; end if; {for only hist table } if empty('Item Code') and '(L) Checkbox0' =false and '(L) Checkbox2'=true and str(Date)="0/0/0000" then range clear table Display_Pricing; range table Display_Pricing where physicalname('Customer Number' of table Display_Pricing) + "= '" + str('Customer Number' of window Window1) + "' and "+ physicalname(Name of table Display_Pricing)+ "='History'"; range clear table Display_Pricing; end if; get first table Display_Pricing; if err() = OKAY then repeat copy from table Display_Pricing to table Display_Pricing_Temp; save table Display_Pricing_Temp; get next table Display_Pricing; until err() = EOF; else clear window Price_Scroll of form 'Customer Pricing Inquiry'; end if; else clear window Price_Scroll of form 'Customer Pricing Inquiry'; end if; fill window Price_Scroll table Display_Pricing_Temp by number 1;

    Read the article

  • Javascript string to Date conversion - simple?

    - by Mark White
    Hi all, Yesterday I managed to solve this, then lost a day's work due to the death of a HD. Now I cannot remember what I did to fix it, but I know it can be done. Input: string date in the format 'm/d/yy', eg '12/25/10', or '4/1/10' (1st April) Output - Date object I'm working with date.js and date.format.js so have Date.fromString() and Date.format() avaiable. But trying multiple combinations is not giving me what I need. IF the date were 'mm/dd/yy' then it's simple. But I'm using jquery.datepicker.js which outputs in 'm/d/yy' and I don't want to change this much I know this conversion can be done. After a 22 hour day... I need help. Thanks. Mark...

    Read the article

  • Java Date Hibernate cut off time

    - by Vlad
    Hi folks, I have a Date type column in Oracle DB and it contains date and time for sure. But when I'm trying to get data in java application it will return date with bunch of zeros instead of real time. In code it'll be like: SQLQuery sqlQuery = session.createSQLQuery("SELECT table.id, table.date FROM table"); List<Object[]> resultArray = sqlQuery.list(); Date date = (Date)resultArray[1]; If it was 26-feb-2010 17:59:16 in DB I'll get 26-feb-2010 00:00:00 How to get it with time?

    Read the article

  • What is the accepted way to replace java.util.Date(year,month,day)

    - by dagw
    I'm trying to do something really simple, but starting to realize that dates in Java are a bit of minefield. All I want is to get passed groups of three ints ( a year, a month and a date) create some Date objects, do some simple test on them (along the lines of as date A before date B and after January 1 1990), convert them to java.sql.Date objects and pass them off to the database via JDBC. All very simple and works fine using the java.util.Date(int year,int month,int day) constructor. Of course that constructor is depreciated, and I'd like to avoid using depreciated calls in new code I'm writing. However all the other options to solve this simple problem seem stupidly complicated. Is there really no simple way to do what I want without using depreciated constructors? I know the standard answer to all Java date related questions is "use joda time", but I really don't want to start pulling in third party libraries for such a seemingly trivial problem.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >