Search Results

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

Page 11/540 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Checking if date parsing is correct

    - by Javi
    Hello, I have this code for checking whether the Date is OK or not, but it's not ckecking all the cases. For example when text="03/13/2009" as this date doesn't exist in the format "dd/MM/yyyy" it parses the date as 03/01/2010. Is there any way to change this behaviour and getting an exception when I try to parse a Date which is not correct? What's the best way to do this validation? public static final String DATE_PATTERN = "dd/MM/yyyy"; public static boolean isDate(String text){ SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN); ParsePosition position = new ParsePosition(0); formatter.parse(text, position); if(position.getIndex() != text.length()){ return false; }else{ return true; } } Thanks.

    Read the article

  • How to set default date in date_select helper in Rails

    - by brad
    I'm trying to set up a date of birth helper in my Rails app (2.3.5). At present it is like so. <%= f.date_select :date_of_birth, :start_year => Time.now.year - 110, :end_year => Time.now.year %> This generates a perfectly functional set of date fields that work just fine but.... They default to today's date which is not ideal for a date of birth field (I'm not sure what is but unless you're running a neonatal unit today's date seems less than ideal). I want it to read Jan 1 2010 instead (or 2011 or whatever year it happens to be). Using the :default option has proven unsuccessful. I've tried many possibilities including; <%= f.date_select :date_of_birth, :default => {:year => Time.now.year, :month => 'Jan', :day => 1}, :start_year => Time.now.year - 110, :end_year => Time.now.year %> and <%= f.date_select :date_of_birth, :default => Time.local(2010,'Jan',1), :start_year => Time.now.year - 110, :end_year => Time.now.year %> None of this changes the behaviour of the first example. Does the default option actually work as described? It seems that this should be a fairly straightforward thing to do. Ta.

    Read the article

  • Java Date vs Calendar

    - by Marty Pitt
    Could someone please advise the current "best practice" around Date and Calendar types. When writing new code, is it best to always favour Calendar over Date, or are there circumstances where Date is the more appropriate datatype?

    Read the article

  • Human readable and parsable date format in Java.

    - by Savvas Dalkitsis
    I want to save a Date object to a readable string (for example 22/10/2009 21:13:14) that is also parsable back to a Date object. I have tried many things and the best I could find was to use DateFormater for parsing and formating but it has a setback. When you format a date you lose seconds information. I tried to find if there is an option to format it and display the seconds (even better would be to the millisecond level since that's the resolution the Date object allows you to have) but I came up short. Any ideas?

    Read the article

  • Parse RSS pubDate to Date object in java

    - by Derk
    How can I parse a pubDate from a RSS feed to a Date object in java. The format in the RSS feed: Sat, 24 Apr 2010 14:01:00 GMT What I have at the moment: DateFormat dateFormat = DateFormat.getInstance(); Date pubDate = dateFormat.parse(item.getPubDate().getText()); But this code throws an ParseException with the message Unparseable date

    Read the article

  • How to edit and display Date in ASP.Net MVC 2

    - by Picflight
    I am storing a date in my database and want the user to be able to edit this date in the Edit View. In the past with ASP.Net web forms I have used 3 dropdownlists for the Month, Day and Year to get the date from the user and to bind it on display. I want to do the same in ASP.Net MVC and not sure how to do it? I am not using any jQuery or Javascript, the design calls for simple postback.

    Read the article

  • grails date from params in controller

    - by nils petersohn
    y is it so hard to extract the date from the view via the params in a grails controller? i don't want to extract the date by hand like this: instance.dateX = parseDate(params["dateX_value"])//parseDate is from my helper class i just want to use instance.properties = params you know :) in the model the type is java.util.Date and in the params is all the information (dateX_month, dateX_day, ...) i searched on the net and found nothing on this :( i hoped that grails 1.3.0 could help but still the same thing. i can't and will not belief that extracting the date by hand is nessesary!

    Read the article

  • number of months between two dates - using boost's date

    - by MartinP
    I've used boost::gregorian::date a bit now. I can see that there are the related months & years & weeks duration types. I can see how to use known durations to advance a given date. Qu: But how can I get the difference between two dates in months (or years or weeks) ? I was hoping to find a function like: template<typename DURATION> DURATION date_diff<DURATION>(const date& d1,const date& d2); There would need to be some handling of rounding too.

    Read the article

  • Core Data data type for just the date - not including time

    - by Jason
    I am new at Core Data, and it seems like it is a great way to manage the data store. However I am also very memory-conscious due to the fact that the iPhone doesn't have that much of it. I was a little surprised to see that the data types are so limited - eg. there is a Date type which includes also the time, but no Date type for just the date! All the time information takes up precious bytes of memory, if I just wanted an attribute with the date (e.g. 2/15/2010 rather than 2/15/2010 02:34:48), how could I do this? Is it possible?

    Read the article

  • convert variable with mixed date formats to one format in r

    - by jalapic
    A sample of my dataframe: date 1 25 February 1987 2 20 August 1974 3 9 October 1984 4 18 August 1992 5 19 September 1995 6 16-Oct-63 7 30-Sep-65 8 22 Jan 2008 9 13-11-1961 10 18 August 1987 11 15-Sep-70 12 5 October 1994 13 5 December 1984 14 03/23/87 15 30 August 1988 16 26-10-1993 17 22 August 1989 18 13-Sep-97 I have a large dataframe with a date variable that has multiple formats for dates. Most of the formats in the variable are shown above- there are a couple of very rare others too. The reason why there are multiple formats is that the data were pulled together from various websites that each used different formats. I have tried using straightforward conversions e.g. strftime(mydf$date,"%d/%m/%Y") but these sorts of conversion will not work if there are multiple formats. I don't want to resort to multiple gsub type editing. I was wondering if I am missing a more simple solution? Code for example: structure(list(date = structure(c(12L, 8L, 18L, 6L, 7L, 4L, 14L, 10L, 1L, 5L, 3L, 17L, 16L, 11L, 15L, 13L, 9L, 2L), .Label = c("13-11-1961", "13-Sep-97", "15-Sep-70", "16-Oct-63", "18 August 1987", "18 August 1992", "19 September 1995", "20 August 1974", "22 August 1989", "22 Jan 2008", "03/23/87", "25 February 1987", "26-10-1993", "30-Sep-65", "30 August 1988", "5 December 1984", "5 October 1994", "9 October 1984"), class = "factor")), .Names = "date", row.names = c(NA, -18L), class = "data.frame")

    Read the article

  • How to sort the row contents on table cell by using date

    - by MS Nathan
    Hi i am new to iphone application development.i am developing RSS feed Reader it has number of different RSS feeds. In my application (XML parsing), i want to display the content of the row on cell for particular date and with their corresponding title, description (in my application, i am using three labels for displaying title, date and description) on table view cell after parsing xml data. And i want to sort the all kinds of RSS feeds row contents(title, date, description) depends upon the date in single another UIViewController and for each RSS feed has a separate ViewController. thanks in advance.

    Read the article

  • Btrieve Date Integer

    - by nmiranda
    Hi everyone, this is my question: I'm migrating data from a Btrieve file (.dat) through Pervasive Control Center and there is field type which is defined as integer but is a date and for example the date '31/12/2009' (seen in the legacy system) is view it as the number 733772 when I export it. The legacy system shows the date correctly but I can't export it in the same format or at least I can't convert it. Does anybody know how to convert this number through Excel or something?

    Read the article

  • Can the current date be inserted into output through XSLT v1.0

    - by Randy
    I have an incoming data stream that is being converted with XSLT v1.0 that incoming data does not contain any date information. what i would like, is a nice way of getting the current date to become part of the resulting output stream. I am aware of the 2.0 current-date() type functions - unfortunately those are not available to this environment... any thoughts/hacks/alternatives? tia

    Read the article

  • date.format in Chrome 5

    - by blueblood
    Hello, I'm experiencing something really strange with my javascript in chrome with Date().format. If I use the console and type: d = new Date(Date.parse("2010-05-28")) d.format("yyyy-MM-dd"); "" d._toFormattedString(); "Fri May 28 2010 00:00:00 GMT+0200 (W. Europe Daylight Time)" Anyone got any clue why I get an empty string? And it's only in Chrome, didn't happen in Chrome 4, and it doesn't happen in IE8/Firefox3.5

    Read the article

  • Java Date & Time of Day

    - by Gaz
    Hi, I have an application that passes in java.util.Date. I want to check whether this date is within a specified time of day (e.g. between 10:30 & 11:30), I don't care about the date, just the time of day. Can anyone show me a simple way to do this? Thanks

    Read the article

  • Optimal way to store and pass a date to Javascript

    - by user1493115
    I need to store a date-time value in MySQL and subsequently display it on a webpage. Due to its flexibility I usually chose to store a Unix timestamp in the database and convert it with PHP's date() to the desired format. This time however I would like to use MySQL's datetime field (mostly due to 2038) and apply the browser's timezone (hence I cannot simply format it on the server and pass the string to the client). I thought of storing the date as UTC datetime in the database and send it as well-defined format to the client, where it will be further processed. Here I would like to avoid a Unix timestamp but everything else might add additional overhead in processing. Is there any best practice as far as date processing is concerned in a MySQL, PHP, JQuery environment? Thanks.

    Read the article

  • I need to add a range for a date input field in jquery

    - by user338413
    I've got an input field in a form that needs a date value. I'm using jQuery UI's datepicker for the calendar and I've set a range for it. However, the user can override that by typing a different date in the input field. How can I specify a date range for the field with jQuery validation? All I see with jQuery is that you can only specify that the field be a date type. Can I create min and max values that work with dates?

    Read the article

  • PHP strtotime() setting date to default

    - by Paddyd
    I have a script which is reading values from an excel sheet and inserting them into an sql table. My problem is when the script reads in some of the date fields it is setting them to a default value : 1970-01-01 01:00:00 I have noticed that this is happening when it comes across a date where the 'day' is greater than 12 : 13/05/2012 18:52:33 (dd-mm-yyyy hh-mm-ss) I thought this may be due to the script thinking that this is the month field (i.e american format) and it sees it as an invalid value, so I set the default timezone to my own hoping it may resolve the problem but it made no difference. date_default_timezone_set('Europe/Dublin'); Here is an example of what my code is doing: Excel field value : 01/05/2012 18:32:45 Script: $start_time = $data->val($x,5); echo $start_time = date("Y-m-d H:i:s", strtotime($start_time)); Output: 2012-01-05 18:32:45 This is the exact format I am looking for (except for the fact that the day and month fields are switched around i.e american date format) but it doesnt work for the type of dates I mentioned above.

    Read the article

  • How do I determine whether calculation was completed, or detect interrupted calculation?

    - by BenTobin
    I have a rather large workbook that takes a really long time to calculate. It used to be quite a challenge to get it to calculate all the way, since Excel is so eager to silently abort calculation if you so much as look at it. To help alleviate the problem, I created some VBA code to initiate the the calculation, which is initiated by a form, and the result is that it is not quite as easy to interrupt the calculation process, but it is still possible. (I can easily do this by clicking the close X on the form, but I imagine there are other ways) Rather than taking more steps to try and make it harder to interrupt calculation, I'd like to have the code detect whether calculation is complete, so it can notify the user rather than just blindly forging on into the rest of the steps in my code. So far, I can't find any way to do that. I've seen references to Application.CalculationState, but the value is xlDone after I interrupt calculation, even if I interrupt the calculation after a few seconds (it normally takes around an hour). I can't think of a way to do this by checking the value of cells, since I don't know which one is calculated last. I see that there is a way to mark cells as "dirty" but I haven't been able to find a way to check the dirtiness of a cell. And I don't know if that's even the right path to take, since I'd likely have to check every cell in every sheet. The act of interrupting calculation does not raise an error, so my ON ERROR doesn't get triggered. Is there anything I'm missing? Any ideas? Any ideas?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >