Search Results

Search found 12247 results on 490 pages for 'julian date'.

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

  • 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

  • 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

  • Insert date and time into Mysql

    - by Jerry
    Hi..guys I am trying to insert date and time into mysql datetime field. When a user select a date and time, it will generate two POST variables. I have searched internet but still not sure how to do it. My code. //date value is 05/25/2010 //time value is 10:00 $date=$_POST['date']; $time=$_POST['time']; $datetime=$date.$time If I insert $datetime into mysql, the date appears to be 0000-00-00:00:00:00 I appreciate it if anyone could help me about this. Thanks.

    Read the article

  • Compare system date with a date field in SQL

    - by JeT_BluE
    I am trying to compare a date record in SQL Server with the system date. In my example the user first register with his name and date of birth which are then stored in the database. The user than logs into the web application using his name only. After logging in, his name is shown on the side where it says "Welcome "player name" using Sessions. What I am trying to show in addition to his name is a message saying "happy birthday" if his date of birth matches the system date. I have tried working with System.DateTime.Now, but what I think is that it is also comparing the year, and what I really want is the day and the month only. I would really appreciate any suggestion or help. CODE In Login page: protected void Button1_Click(object sender, EventArgs e) { String name = TextBox1.Text; String date = System.DateTime.Today.ToShortDateString(); SqlConnection myconn2 = new SqlConnection(ConfigurationManager.ConnectionStrings["User"].ToString()); SqlCommand cmd2 = new SqlCommand(); SqlDataReader reader; myconn2.Open(); cmd2 = new SqlCommand("Select D_O_B from User WHERE Username = @username", myconn2); cmd2.Parameters.Add("@username", SqlDbType.NVarChar).Value = name; cmd2.Connection = myconn2 cmd2.ExecuteNonQuery(); reader = cmd2.ExecuteReader(); while (reader.Read().ToString() == date) { Session["Birthday"] = "Happy Birthday"; } } Note: I using the same reader in the code above this one, but the reader here is with a different connection. Also, reader.Read() is different than reader.HasRows? Code in Web app Page: string date = (string)(Session["Birthday"]); // Retrieving the session Label6.Text = date;

    Read the article

  • extract day from Date

    - by Daniel
    i receive a timestamp from a soap service in miliseconds.. so i do Date date = new Date(mar.getEventDate()); how can i extract the day of the month from date, since getDay() and so are deprecated? im using a small hack, but i dont think this is the proper way.. SimpleDateFormat sdf = new SimpleDateFormat("dd"); int day = Integer.parseInt(sdf.format(date));

    Read the article

  • Date object javascript

    - by Isis
    Hello. var date = new Date();//Mon Mar 15 2010 12:40:05 GMT+0300 (MSK) var omg = date.getDate() + 19;// 34 date.setDate(omg); document.write(date.toLocaleString()); //Sat 03 Apr 2010 12:43:00 PM MSK How do I echo the values 3 (ie: day of month), 4 (April) and the current year? alert(day); // Need 3 alert(month); // Need 4 Thank you

    Read the article

  • SOLR date faceting and BC / BCE dates / negative date ranges

    - by Nigel_V_Thomas
    Date ranges including BC dates is this possible? I would like to return facets for all years between 11000 BCE (BC) and 9000 BCE (BC) using SOLR. A sample query might be with date ranges converted to ISO 8601: q=*:*&facet.date=myfield_earliestDate&facet.date.end=-92009-01-01T00:00:00&facet.date.gap=%2B1000YEAR&facet.date.other=all&facet=on&f.myfield_earliestDate.facet.date.start=-112009-01-01T00:00:00 However the returned results seem to be suggest that dates are in positive range, ie CE, not BCE... see sample returned results <response> <lst name="responseHeader"> <int name="status">0</int> <int name="QTime">6</int> <lst name="params"> <str name="f.vra.work.creation.earliestDate.facet.date.start">-112009-01-01T00:00:00Z</str> <str name="facet">on</str> <str name="q">*:*</str> <str name="facet.date">vra.work.creation.earliestDate</str> <str name="facet.date.gap">+1000YEAR</str> <str name="facet.date.other">all</str> <str name="facet.date.end">-92009-01-01T00:00:00Z</str> </lst> </lst> <result name="response" numFound="9556" start="0">ommitted</result> <lst name="facet_counts"> <lst name="facet_queries"/> <lst name="facet_fields"/> <lst name="facet_dates"> <lst name="vra.work.creation.earliestDate"> <int name="112010-01-01T00:00:00Z">0</int> <int name="111010-01-01T00:00:00Z">0</int> <int name="110010-01-01T00:00:00Z">0</int> <int name="109010-01-01T00:00:00Z">0</int> <int name="108010-01-01T00:00:00Z">0</int> <int name="107010-01-01T00:00:00Z">0</int> <int name="106010-01-01T00:00:00Z">0</int> <int name="105010-01-01T00:00:00Z">0</int> <int name="104010-01-01T00:00:00Z">0</int> <int name="103010-01-01T00:00:00Z">0</int> <int name="102010-01-01T00:00:00Z">0</int> <int name="101010-01-01T00:00:00Z">0</int> <int name="100010-01-01T00:00:00Z">5781</int> <int name="99010-01-01T00:00:00Z">0</int> <int name="98010-01-01T00:00:00Z">0</int> <int name="97010-01-01T00:00:00Z">0</int> <int name="96010-01-01T00:00:00Z">0</int> <int name="95010-01-01T00:00:00Z">0</int> <int name="94010-01-01T00:00:00Z">0</int> <int name="93010-01-01T00:00:00Z">0</int> <str name="gap">+1000YEAR</str> <date name="end">92010-01-01T00:00:00Z</date> <int name="before">224</int> <int name="after">0</int> <int name="between">5690</int> </lst> </lst> </lst> </response> Any ideas why this is the case, can solr handle negative dates such as -112009-01-01T00:00:00Z?

    Read the article

  • how to parse string into a date pattern using dojo

    - by Dojouser
    Hi, I have a value as '05/17/2010' I would like to get it as May 17, 2010 by using dojo.date.locale.I have tried using the dojo.date.locale.parse as follows : x = '05/17/2010' var x= dojo.date.locale.parse(x, {datePattern: "MM/dd/yyyy", selector: "date"}); alert(x) This doesnt give me the desired date pattern I also tried replacing the pattern as datePattern : "MMMM d, yyyy" but it returns me null. Any help highly appreciated. Thanks

    Read the article

  • how can I select data from MySQL based on date (unix time record)

    - by bn
    I have a record of data with unix time date in it i want to select the row based on the date/month/year only (not with time) currently Im using something like this select * from tablename where date > '$today' and date < '$tomorow' LIMIT 1; how ever this is not that accurate if the $today and $tomorrow have different time (but same date) is there any better way to do this?

    Read the article

  • How to add days to a date in Java

    - by terrific
    I want to add days to a date to get a new date in Java. How to achieve it using the Calender class. Calender dom = new GregorianCalender(d, m y); is the instance of my date of manufacture and I want to reach to date of expiry adding some 100 days to the current date and store it in doe but unable to do that. Any help would be appreciable.

    Read the article

  • Determine week number based on starting date

    - by kreetiv
    I need help to create a function to determine the week number based on these 2 parameters: Starting date Specified date For example, if I specify April 7, 2010 as the starting date & passed April 20, 2010 as the date to lookup, I would like the function to return WEEK 2. Another example, if I set March 6, 2010 as starting date and looked up April 5, 2010 then it should return WEEK 6. I appreciate your time and help.

    Read the article

  • How do you convert date taken from a bash script to milliseconds in java program?

    - by Matt Pascoe
    I am writing a piece of code in java that needs to take a time sent from a bash script and parse the time to milliseconds. When I check the millisecond conversion on the date everything is correct except for the month I have sent which is January instead of March. Here is the variable I create in the bash script, which later in the script I pass to the java program: TIME=`date +%m%d%Y_%H:%M:%S` Here is the java code which parses the time to milliseconds: String dt = "${scriptstart}"; java.text.SimpleDateFormat scriptStart = new java.text.SimpleDateFormat("MMDDyyyy_HH:mm:ss"); long start = scriptStart.parse(dt).getTime(); The goal of this statement is to find the elapsed time between the start of the script and the current system time. To troubleshoot this I printed out the two: System Time = 1269898069496 (converted = Mon Mar 29 2010 16:27:49 GMT-0500 (Central Daylight Time)) Script Start = 03292010_16:27:45 Script Start in Milli = 1264804065000 (Converted = Fri Jan 29 2010 16:27:45 GMT-0600 (Central Standard Time))

    Read the article

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