Search Results

Search found 13488 results on 540 pages for 'calculator date calculation'.

Page 7/540 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Selecting date NOT NULL records between a specific range with Propel

    - by Jon Winstanley
    Using Propel I would like to find records which have a date field which is not null and also between a specific range. However, Propel seems to overwrite the criteria with the NOTNULL criteria. Is it possible to do this? //create the date ranges $start_date = mktime(0, 0, 0, date("m") , date("d")+$start, date("Y")); $end_date = mktime(0, 0, 0, date("m") , date("d")+$end, date("Y")); //add the start of the range $c1 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c1->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, $end_date, Criteria::LESS_EQUAL)); $c->add($c1); //add the end of the range $c2 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c2->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, $start_date, Criteria::GREATER_EQUAL)); $c->add($c2); //remove the null entries $c3 = $c->getNewCriterion(TaskPeer::DUE_DATE, null); $c3->addAnd($c->getNewCriterion(TaskPeer::DUE_DATE, null, Criteria::ISNULL)); $c->add($c3);

    Read the article

  • How to get Date and current time from the Date/Time column in SharePoint Custom list

    - by Kanta
    I have column called "Date Submitted" as Date/time in one of the Custom list in sharepoint 2007. it always set to today's date and 12AM time instead of that I want to display today's date with current time hh:mm:ss. I tried creating calculated column TestDate and formula is : =TEXT(([Date Submitted]),"mm dd yyyy h:MM:SS") result is 04 28 2010 0:00:00 I wanted to be 04/28/2010 10:50:34 Is it possible to achive this? Thank you kanta

    Read the article

  • SQL Azure Database Size Calculator

    - by kaleidoscope
    A neat trick on how to measure your database size in SQL Azure.  Here are the exact queries you can run to do it: Select Sum (reserved_page_count) * 8.0 / 1024 From sys.dm_db_partition_stats GO Select sys.objects.name, sum (reserved_page_count) * 8.0 / 1024 From sys.dm_db_partition_stats, sys.objects Where sys.dm_db_partition_stats.object_id = sys.objects.object_id Group by sys.objects.name The first one will give you the size of your database in MB and the second one will do the same, but break it out for each object in your database. http://www.azurejournal.com/2010/03/sql-azure-database-size-calculator/   Ritesh, D

    Read the article

  • Website Value Calculator - Know What Your Website is Worth Before Selling It

    We all know how important it is to have a website of your own when you are into an online business. If you would like to maintain your own website or if you are selling them to earn some money, it is definitely important for you to know what is the true value of your websites. How do you do this? With the help of a website value calculator you will now have the ability to know your site's worth.

    Read the article

  • Ok to use table for calculator? [closed]

    - by max
    I'm a php/mysql guy, and have been trying to brush up on my frontend skills. So this weekend I made a four function calculator in javascript. But when I started to work on the presentation, I found myself adding extraneous markup just to achieve what a table tag naturally does. Just so we're on the same page, this is the intended layout: 789+ 456- 123x c0=/ It it possible to generate this grid using neither a table, nor extraneous markup? Thank you.

    Read the article

  • MDX using EXISTING, AGGREGATE, CROSSJOIN and WHERE

    - by James Rogers
    It is a well-published approach to using the EXISTING function to decode AGGREGATE members and nested sub-query filters.  Mosha wrote a good blog on it here and a more recent one here.  The use of EXISTING in these scenarios is very useful and sometimes the only option when dealing with multi-select filters.  However, there are some limitations I have run across when using the EXISTING function against an AGGREGATE member:   The AGGREGATE member must be assigned to the Dimension.Hierarchy being detected by the EXISTING function in the calculated measure. The AGGREGATE member cannot contain a crossjoin from any other dimension or hierarchy or EXISTING will not be able to detect the members in the AGGREGATE member.   Take the following query (from Adventure Works DW 2008):   With   member [Week Count] as 'count(existing([Date].[Fiscal Weeks].[Fiscal Week].members))'    member [Date].[Fiscal Weeks].[CM] as 'AGGREGATE({[Date].[Fiscal Weeks].[Fiscal Week].&[47]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[48]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[49]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[50]&[2004]})'   select   {[Week Count]} on columns from   [Adventure Works]     where   [Date].[Fiscal Weeks].[CM]   Here we are attempting to count the existing fiscal weeks in slicer.  This is useful to get a per-week average for another member. Many applications generate queries in this manner (such as Oracle OBIEE).  This query returns the correct result of (4) weeks. Now let's put a twist in it.  What if the querying application submits the query in the following manner:   With   member [Week Count] as 'count(existing([Date].[Fiscal Weeks].[Fiscal Week].members))'    member [Customer].[Customer Geography].[CM] as 'AGGREGATE({[Date].[Fiscal Weeks].[Fiscal Week].&[47]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[48]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[49]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[50]&[2004]})'   select   {[Week Count]} on columns from   [Adventure Works]     where   [Customer].[Customer Geography].[CM]   Here we are attempting to count the existing fiscal weeks in slicer.  However, the AGGREGATE member is built on a different dimension (in name) than the one EXISTING is trying to detect.  In this case the query returns (174) which is the total number of [Date].[Fiscal Weeks].[Fiscal Week].members defined in the dimension.   Now another twist, the AGGREGATE member will be named appropriately and contain the hierarchy we are trying to detect with EXISTING but it will be cross-joined with another hierarchy:   With   member [Week Count] as 'count(existing([Date].[Fiscal Weeks].[Fiscal Week].members))'    member [Date].[Fiscal Weeks].[CM] as 'AGGREGATE({[Date].[Fiscal Weeks].[Fiscal Week].&[47]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[48]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[49]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[50]&[2004]}*    {[Customer].[Customer Geography].[Country].&[Australia],[Customer].[Customer Geography].[Country].&[United States]})'  select   {[Week Count]} on columns from   [Adventure Works]    where   [Date].[Fiscal Weeks].[CM]   Once again, we are attempting to count the existing fiscal weeks in slicer.  Again, in this case the query returns (174) which is the total number of [Date].[Fiscal Weeks].[Fiscal Week].members defined in the dimension. However, in 2008 R2 this query returns the correct result of 4 and additionally , the following will return the count of existing countries as well (2):   With   member [Week Count] as 'count(existing([Date].[Fiscal Weeks].[Fiscal Week].members))'   member [Country Count] as 'count(existing([Customer].[Customer Geography].[Country].members))'  member [Date].[Fiscal Weeks].[CM] as 'AGGREGATE({[Date].[Fiscal Weeks].[Fiscal Week].&[47]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[48]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[49]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[50]&[2004]}*    {[Customer].[Customer Geography].[Country].&[Australia],[Customer].[Customer Geography].[Country].&[United States]})'  select   {[Week Count]} on columns from   [Adventure Works]    where   [Date].[Fiscal Weeks].[CM]   2008 R2 seems to work as long as the AGGREGATE member is on at least one of the hierarchies attempting to be detected (i.e. [Date].[Fiscal Weeks] or [Customer].[Customer Geography]). If not, it seems that the engine cannot find a "point of entry" into the aggregate member and ignores it for calculated members.   One way around this would be to put the sets from the AGGREGATE member explicitly in the WHERE clause (slicer).  I realize this is only supported in SSAS 2005 and 2008.  However, after talking with Chris Webb (his blog is here and I highly recommend following his efforts and musings) it is a far more efficient way to filter/slice a query:   With   member [Week Count] as 'count(existing([Date].[Fiscal Weeks].[Fiscal Week].members))'    select   {[Week Count]} on columns from   [Adventure Works]    where   ({[Date].[Fiscal Weeks].[Fiscal Week].&[47]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[48]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[49]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[50]&[2004]}   ,{[Customer].[Customer Geography].[Country].&[Australia],[Customer].[Customer Geography].[Country].&[United States]})   This query returns the correct result of (4) weeks.  Additionally, we can count the cross-join members of the two hierarchies in the slicer:   With   member [Week Count] as 'count(existing([Date].[Fiscal Weeks].[Fiscal Week].members)*existing([Customer].[Customer Geography].[Country].members))'    select   {[Week Count]} on columns from   [Adventure Works]    where   ({[Date].[Fiscal Weeks].[Fiscal Week].&[47]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[48]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[49]&[2004],[Date].[Fiscal Weeks].[Fiscal Week].&[50]&[2004]}   ,{[Customer].[Customer Geography].[Country].&[Australia],[Customer].[Customer Geography].[Country].&[United States]})   We get the correct number of (8) here.

    Read the article

  • Is there a fix to display 0 when arithmetic underflow occurs on the Windows 7 calculator?

    - by Pascal Qyy
    I have a problem that exasperates me: When I take the Windows 7 calculator in standard mode, if I do 4, then v (square root), the result is 2 Fine. But, at this point, if I do - (minus), then 2, the result is -1,068281969439142e-19 instead of 0! OK, I know about ? (machine epsilon), and yes, -1,068281969439142e-19 is less than the 64 bits ? (1.11e-16), so, we have an arithmetic underflow, in other words in this case: 0. Great, my computer is able to represent subnormal numbers instead of just flush to zero when this happens, and it seems that it is an improvement! Subnormal values fill the underflow gap with values where the absolute distance between them are the same as for adjacent values just outside of the underflow gap. This is an improvement over the older practice to just have zero in the underflow gap, and where underflowing results were replaced by zero (flush to zero). BUT: this result is false! when you try to explain the concept of the square root to a child and you end up with this kind of result, it only complicates your task... what is the point to represent subnormal numbers in a standard, non scientific calculator? So, is there a way to fix this?

    Read the article

  • Windows 7 System Tray Date Display Not Appearing

    - by Anton
    I'm using Windows 7 RC and for some reason, the date won't show at all on my system tray. It used to for a while, but one day it just stopped (I didn't even notice it until someone pointed it out). So I've been trying to fix it, by customizing the format of the date, resetting to defaults, etc... But nothing works, it still doesn't show. The time appears fine.

    Read the article

  • Python to see if a file falls into a date range

    - by tod
    I have a script that I want to have an if statement check if a file falls between several specified date periods as it searches directories. I have been able to get the time in %Y-%m-%d format for the file, but I can't seem to be able to specify a date range for python to go through. Any ideas/help? Here's what I have so far for name in files: f = os.path.join(root, name) dt = os.path.getmtime(f) nwdt = time.gmtime(dt) ndt = time.strftime('%Y-%m-%d', nwdt)

    Read the article

  • How to get the Date in a batch file in a predictable format?

    - by AngryHacker
    In a batch file I need to extract a month, day, year from the date command. So I used the following, which essentially parses the Date command to extract its sub strings into a variable: set Day=%Date:~3,2% set Mth=%Date:~0,2% set Yr=%Date:~6,4% This is all great, but if I deploy this batch file to a machine with a different regional/country settings, it fails because month, day and year are in different locations. How can I extract month, day and year regardless of the date format?

    Read the article

  • DATE function does not support all the dates in DAX by design #powerpivot #tabular #dax

    - by Marco Russo (SQLBI)
    The DATE function in DAX has this simple syntax: DATE( <year>, <month>, <day> ) If you are like me, you never read the BOL notes that says in a clear way that it supports dates beginning with March 1, 1900. In fact, I was wrongly assuming that it would have supported any date that can be represented in a Date data type in Data Models, so all the dates beginning with January 1, 1900. The funny thing is that in some of the BOL documentation you will find that Date data type supports dates after March 1, 1900 (which seems not including that date, but this is a detail…). But we should not digress. The real issue is that if you try to call the DATE function passing values between January 1 and February 28, 1900, you will see a different day as a result. evaluate row ( "x", DATE( 1900, 1, 1 ) ) -- return WRONG result -- [x] 12/31/1899 12:00:00 AM   evaluate row ( "x", DATE( 1901, 2, 29 ) ) -- return WRONG result -- [x] 2/28/1900 12:00:00 AM   evaluate row ( "x", DATE( 1900, 3, 1 ) ) -- return CORRECT result -- [x] 3/1/1900 12:00:00 AM As usual, this is not a bug. It is “by design”. The DATE function works in this way in Excel. And also in Excel it was “by design”. In this case the design is having the same bug of Lotus 1-2-3 that handled 1900 a leap year, even though it isn’t. The first release of Lotus 1-2-3 is dated 1983. I hope many of my readers are younger than that. I tried to open a bug in Connect. Please vote it. I would like if Microsoft changed this type of items from “by design” (as we can expect) to “by genetic disease”. Or by “historical respect”, in order to be more politically correct.

    Read the article

  • Viewport / Camera Calculation in 2D Game

    - by Dave
    we have a 2D game with some sprites and tiles and some kind of camera/viewport, that "moves" around the scene. so far so good, if we wouldn't had some special behaviour for your camera/viewport translation. normally you could stick the camera to your player figure and center it, resulting in a very cheap, undergraduate, translation equation, like : vec_translation -/+= speed (depending in what keys are pressed. WASD as default.) buuuuuuuuuut, we want our player figure be able to actually reach the bounds, when the viewport/camera has reached a maximum translation. we came up with the following solution (only keys a and d are the shown here, the rest is just adaption of calculation or maybe YOUR super-cool and elegant solution :) ): if(keys[A]) { playerX -= speed; if(playerScreenX <= width / 2 && tx < 0) { playerScreenX = width / 2; tx += speed; } else if(playerScreenX <= width / 2 && (tx) >= 0) { playerScreenX -= speed; tx = 0; if(playerScreenX < 0) playerScreenX = 0; } else if(playerScreenX >= width / 2 && (tx) < 0) { playerScreenX -= speed; } } if(keys[D]) { playerX += speed; if(playerScreenX >= width / 2 && (-tx + width) < sceneWidth) { playerScreenX = width / 2; tx -= speed; } if(playerScreenX >= width / 2 && (-tx + width) >= sceneWidth) { playerScreenX += speed; tx = -(sceneWidth - width); if(playerScreenX >= width - player.width) playerScreenX = width - player.width; } if(playerScreenX <= width / 2 && (-tx + width) < sceneWidth) { playerScreenX += speed; } } i think the code is rather self explaining: keys is a flag container for currently active keys, playerX/-Y is the position of the player according to world origin, tx/ty are the translation components vital to background / npc / item offset calculation, playerOnScreenX/-Y is the actual position of the player figure (sprite) on screen and width/height are the dimensions of the camera/viewport. this all looks quite nice and works well, but there is a very small and nasty calculation error, which in turn sums up to some visible effect. let's consider following piece of code: if(playerScreenX <= width / 2 && tx < 0) { playerScreenX = width / 2; tx += speed; } it can be translated into plain english as : if the x position of your player figure on screen is less or equal the half of your display / camera / viewport size AND there is enough space left LEFT of your viewport/camera then set players x position on screen to width half, increase translation (because we subtract the translation from something we want to move). easy, right?! doing this will create a small delta between playerX and playerScreenX. after so much talking, my question appears now here at the bottom of this document: how do I stick the calculation of my player-on-screen to the actual position of the player AND having a viewport that is not always centered aroung the players figure? here is a small test-case in processing: http://pastebin.com/bFaTauaa thank you for reading until now and thank you in advance for probably answering my question.

    Read the article

  • count how many days within a date range are within another date range

    - by joko13
    From October 1st to March 31 the fee is $1 (season 1). From April 1st to September 30 the fee is $2 (season 2). How can I calculate the total fee of a given date range (user input) depending on how many days of this date range fall into season 1 and season 2? The following gives me the number of days of the user´s date range, but I have no idea how to test against season 1 or season 2: $user_input_start_date = getdate( $a ); $user_input_end_date = getdate( $b ); $start_date_new = mktime( 12, 0, 0, $user_input_start_date['mon'], $user_input_start_date['mday'], $user_input_start_date['year'] ); $end_date_new = mktime( 12, 0, 0, $user_input_end_date['mon'], $user_input_end_date['mday'], $user_input_end_date['year'] ); return round( abs( $start_date_new - $end_date_new ) / 86400 ); Thanks for your help! EDIT: Given that a date range starts and ends in 2012 or starts in 2012 and ends in 2013 alone gives me 10 different possibilities of in which season a date range can start and where it can end. There must be a better solution than iterating if/else and comparing dates over and over again for the following conditions: Date range is completely within season 1 Date range starts in season 1 and ends in season 2 Date range starts in season 1, spans across season 2 and ends in the second part of season 1 ... and so forth with "Starts in season 2", etc

    Read the article

  • Mac OS date command - getting higher temporal resolution

    - by Mark
    Hey all, I am trying to use the date command in Terminal on multiple Mac OS X machines that are synced via NTP to synchronize some code in a program. Essentially I am running a program... MyProgram with arguments[date] I can get date to give me the seconds since the Unix epoch with the %M specifier. When I try to use %N to get nanosecond resolution, date just returns N. Is there anyway to get date to give me finer then second resolution? I wouldn't even mind passing two arguments such as (date +%M):arg2 And then converting units in the program. Many thanks in advance! %N specifier listed here: http://en.wikipedia.org/wiki/Date_(Unix)

    Read the article

  • Java - Parsing a Date from a String

    - by Yatendra Goel
    I want to parse a java.util.Date from a String. I tried the following code but got unexpected output: Date getDate() { Date date = null; SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM dd"); try { date = sdf.parse("Sat May 11"); } catch (ParseException ex) { Logger.getLogger(URLExtractor.class.getName()).log(Level.SEVERE, null, ex); return null; } return date; } When I run the above code, I got the following output: Mon May 11 00:00:00 IST 1970

    Read the article

  • Mac OS date command - getting higher resolution time

    - by Mark
    Hey all, I am trying to use the date command in Terminal on multiple Mac OS X machines that are synced via NTP to synchronize some code in a program. Essentially I am running a program... MyProgram with arguments[date] I can get date to give me the seconds since the Unix epoch with the %M specifier. When I try to use %N to get nanosecond resolution, date just returns N. Is there anyway to get date to give me finer then second resolution? I wouldn't even mind passing two arguments such as (date +%M):arg2 And then converting units in the program. Many thanks in advance! %N specifier listed here: http://en.wikipedia.org/wiki/Date_(Unix)

    Read the article

  • Twitter date unparseable?

    - by Andreas
    Hi, I want to convert the date string in a Twitter response to a Date object, but I always get a ParseException and I cannot see the error!?! Input string: Thu Dec 23 18:26:07 +0000 2010 SimpleDateFormat Pattern: EEE MMM dd HH:mm:ss ZZZZZ yyyy Method: public static Date getTwitterDate(String date) { SimpleDateFormat sf = new SimpleDateFormat(TWITTER); sf.setLenient(true); Date twitterDate = null; try { twitterDate = sf.parse(date); } catch (Exception e) {} return twitterDate; } I also tried this: http://friendpaste.com/2IaKdlT3Zat4ANwdAhxAmZ but that gives the same result. I use Java 1.6 on Mac OS X. Cheers, Andi

    Read the article

  • Subtracting Delphi Time Ranges from a Date Range, Calculate Remaining Time

    - by Anagoge
    I'm looking for an algorithm that will help calculate a workday working time length. It would have an input date range and then allow subtracting partially or completely intersecting time range slices from that date range and the result would be the number of minutes (or the fraction/multiple of a day) left in the original date range, after subtracting out the various non-working time slices. For Example: Input date range: 1/4/2010 11:21 am - 1/5/2010 3:00 pm Subtract out any partially or completely intersecting slices like this: Remove all day Sunday Non-Sundays remove 11:00 - 12:00 Non-Sundays remove time after 5:00 pm Non-Sundays remove time before 8:00 am Non-Sundays remove time 9:15 - 9:30 am Output: # of minutes left in the input date range I don't need anything overly-general. I could hardcode the rules to simplify the code. If anyone knows of sample code or a library/function somewhere, or has some pseudo-code ideas, I'd love something to start with. I didn't see anything in DateUtils, for example. Even a basic function that calculates the number of minutes of overlap in two date ranges to subtract out would be a good start.

    Read the article

  • Wordpress Events List Date Problem

    - by Roger
    Hi, I'm having a problem displaying events in the correct order in wordpress. I think the problem is because wordpress is treating the date as a string and ordering it by the day because it's in british date format. The goal is to display a list of future events with the most current event at the top of the list. But I must use the british date format of dd/mm/yyyy. Do I need to go back to the drawing board or is there a way of converting the date to achieve the result I need? Thanks in advance :) <ul> <?php // Get today's date in the right format $todaysDate = date('d/m/Y');?> <?php query_posts('showposts=50&category_name=Training&meta_key=date&meta_compare=>=&meta_value=' . $todaysDate . '&orderby=meta_value&order=ASC'); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <li> <h3><a href="<?php the_permalink(); ?>"> <?php the_title(); ?> </a></h3> <?php $getDate = get_post_meta($post->ID, 'date', TRUE); $dateArray = explode('/', $getDate); ?> <?php if($getDate != '') { ?> <div class="coursedate rounded"><?php echo date('d F Y', mktime(0, 0, 0, $dateArray[1], $dateArray[0], $dateArray[2])); ?></div> <?php } ?> <p><?php get_clean_excerpt(140, get_the_content()); ?>...</p> <p><strong><a class="link" href="<?php the_permalink(); ?>">For further details and booking click here</a></strong></p> </li> <?php endwhile; ?> <?php else : ?> <li>Sorry, no upcoming events!</li> <?php endif; ?>

    Read the article

  • Create lags with a for-loop in R

    - by cptn
    I've got a data.frame with stock data of several companies (here it's only two). I want 10 additional columns in my stock data.frame df with lagged dates (from -5 days to +5 days) for both companies in my event data.frame. I'm using a for loop which is probably not the best solution, but it works partially. DATE <- c("01.01.2000","02.01.2000","03.01.2000","06.01.2000","07.01.2000","09.01.2000","10.01.2000","01.01.2000","02.01.2000","04.01.2000","06.01.2000","07.01.2000","09.01.2000","10.01.2000") RET <- c(-2.0,1.1,3,1.4,-0.2, 0.6, 0.1, -0.21, -1.2, 0.9, 0.3, -0.1,0.3,-0.12) COMP <- c("A","A","A","A","A","A","A","B","B","B","B","B","B","B") df <- data.frame(DATE, RET, COMP, stringsAsFactors=F) df # DATE RET COMP # 1 01.01.2000 -2.00 A # 2 02.01.2000 1.10 A # 3 03.01.2000 3.00 A # 4 06.01.2000 1.40 A # 5 07.01.2000 -0.20 A # 6 09.01.2000 0.60 A # 7 10.01.2000 0.10 A # 8 01.01.2000 -0.21 B # 9 02.01.2000 -1.20 B # 10 04.01.2000 0.90 B # 11 06.01.2000 0.30 B # 12 07.01.2000 -0.10 B # 13 09.01.2000 0.30 B # 14 10.01.2000 -0.12 B this loop works fine comp <- as.vector(unique(df$COMP)) mylist <- vector('list', length(comp)) # create lags in DATE for(i in 1:length(comp)) { print(i) comp_i <- comp[i] df_k <- df[df$COMP %in% comp_i, ] # all trading days of one firm df_k <- transform(df_k, DATEm1 = c(NA, head(DATE, -1)), DATEm2 = c(NA, NA, head(DATE, -2)), DATEm3 = c(NA, NA, NA, head(DATE, -3)), DATEm4 = c(NA, NA, NA, NA,head(DATE, -4)), DATEm5 = c(NA, NA, NA, NA, NA, head(DATE, -5)), DATEp1 = c(DATE[-1], NA)) #DATEp2 = c(DATE[-2], NA, NA), #DATEp3 = c(DATE[-3], NA, NA, NA), #DATEp4 = c(DATE[-4], NA, NA, NA, NA), #DATEp5 = c(DATE[-5], NA, NA, NA, NA, NA)) mylist[[i]] = df_k } df1 <- do.call(rbind, mylist) But if I add the lines with DATEp2, DATEp3, DATEp4, DATEp5. the code doesn't work. Can anybody tell me what I'm doing wrong here? Here the code with all the lagged dates. # create lags in DATE for(i in 1:length(comp)) { print(i) comp_i <- comp[i] df_k <- df[df$COMP %in% comp_i, ] # all trading days of one firm df_k <- transform(df_k, DATEm1 = c(NA, head(DATE, -1)), DATEm2 = c(NA, NA, head(DATE, -2)), DATEm3 = c(NA, NA, NA, head(DATE, -3)), DATEm4 = c(NA, NA, NA, NA,head(DATE, -4)), DATEm5 = c(NA, NA, NA, NA, NA, head(DATE, -5)), DATEp1 = c(DATE[-1], NA), DATEp2 = c(DATE[-2], NA, NA), DATEp3 = c(DATE[-3], NA, NA, NA), DATEp4 = c(DATE[-4], NA, NA, NA, NA), DATEp5 = c(DATE[-5], NA, NA, NA, NA, NA)) mylist[[i]] = df_k } df1 <- do.call(rbind, mylist)

    Read the article

  • Store date object in sqlite database

    - by bnabilos
    Hello, I'm using a database in my Java project and I want to store date in it, the 5th and the 6th parameter are Date Object. I used the solution below but I have errors in these 2 lines : creerFilm.setDate(5, new Date (getDateDebut().getDate())); creerFilm.setDate(6, new Date (getDateFin().getDate())); PreparedStatement creerFilm = connecteur.getConnexion().prepareStatement("INSERT INTO FILM (ID, REF, NOM, DISTRIBUTEUR, DATEDEBUT, DATEFIN) VALUES (?, ?, ?, ?, ?, ?)"); creerFilm.setInt(1, getId()); creerFilm.setString(2, getReference()); creerFilm.setString(3, getNomFilm()); creerFilm.setString(4, getDistributeur()); creerFilm.setDate(5, new Date (getDateDebut().getDate())); creerFilm.setDate(6, new Date (getDateFin().getDate())); creerFilm.executeUpdate(); creerFilm.close(); Can you help me to fix that please ? Thank you

    Read the article

  • How to distinguish date at midnight from date w/o time in Oracle?

    - by Swiety
    I would like to distinguish date at midnight (i.e. '12/05/2010 00:00:00') from date without time specified (i.e. '12/05/2010'). This value is provided by user, sometimes it is only date which is important, sometimes it is date and time and later the application is expected to show the time only when it was explicitly provided. So for the following inputs I would expect the following outputs: for '12/05/2010' I would expect '12/05/2010' for '12/05/2010 09:23' I would expect '12/05/2010 09:23' for '12/05/2010 00:00' I would expect '12/05/2010 00:00' I know I can model it in two separate columns, date and time, but I was wondering was there any way of handling this in single date column?

    Read the article

  • Most simple way to do holiday calculation?

    - by brainfrog
    I want to make a little free calendar program to help me and others calculate how much time we have got left in a project. I mean real working time, not just time. Time in a raw form is not saying much. Typically when my boss tells me that I have time until 05-05-2011 it doesn't tell me really how much time I have to do my job. You know...so many things stop me from work: A) beeing at home, not at work (so called "free time" or "spare time"). That is in my case I work exactly 8 hours a day and then the cleaning ladies throw me out of the office with their incredible loud industrial vacuum cleaners every evening (my boss accepts that as an excuse to go home in time, regularly). B) weekends, or more precisely saturdays and sundays C) official holiday rescuing me from having to go to work. what I want to do is make a little utility which tells me how many working hours I really have in a given time period. The first two things A and B are pretty easy to implement. But the last thing C scares my pants off. Holidays. OOOHHH man. You know what that means. Chaos. Pure chaos. The huge question is: HOW TO CALCULATE HOLIDAYS?! Since I want my program to be useful for anyone anywhere in the world, I can't just hardcode all holidays for my little town. So which options do I have? I) I could hand-craft downloadable lists of holidays. Users search them within the application and download them from an webserver. Or I ship all of them in the package. But I would get very, very old if I tried that by myself for every country, state and town. II) I make an initial data sheet with holidays for my town, and don't care about the rest. However, I make that sheet with an how-to public, so that everyone who feels like beeing very nice can provide holiday data for his country / region / whatever. Those are made public on a webserver and everyone can get the data packages he/she needs for the app. III) ? I care a lot about usability. I don't want to make an ugly linux hack style hard to use app that only computer freaks can use. So you need to tell me more about holiday science. I was never really clever at this. I assume every single country in the world has it's own set of holidays. In every country there may be several states. For example the US has some, and Germany has also some states. Holidays vary from state to state. But I know from an good programmer he told me never assume anything. So the questions about holiday science are: Which categories do I need to make holiday-data-packs searchable? A guy from India should find quickly his holiday data pack, and a guy from Sillicon Valley should find his pack as equally fast. It makes most sense to me to filter for COUNTRY STATE WHATEVER. Like a drill-down-search. Did I miss something? What would be the best data format to hold holiday information? A holiday has a start and end date and a name. That should be enough. Would I put all this stuff in thousands of XML files? How would you go about this? Any hint / help is highly welcome! Thanks to everyone!

    Read the article

  • Help to calculate hours and minutes between two time periods in Excel 2007

    - by Mestika
    Hi, I’m working on a very simple timesheet for my work in Excel 2007 but have ran into trouble about calculate the hours and minutes between two time periods. I have a field: timestart which could be for example: 08:30 Then I have a field timestop which could be for example: 12:30 I can easy calculate the result myself which is 4 hours but how do I create a “total” table all the way down the cell that calculate the hours spend on each entry? I’ve tried to play around with the time settings but it just give me wrong numbers each time. Sincerely Mestika

    Read the article

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