Search Results

Search found 12421 results on 497 pages for 'date arithmetic'.

Page 35/497 | < Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >

  • Java: JPA classes, refactoring from Date to DateTime

    - by bguiz
    With a table created using this SQL Create Table X ( ID varchar(4) Not Null, XDATE date ); and an entity class defined like so @Entity @Table(name = "X") public class X implements Serializable { @Id @Basic(optional = false) @Column(name = "ID", nullable = false, length = 4) private String id; @Column(name = "XDATE") @Temporal(TemporalType.DATE) private Date xDate; //java.util.Date ... } With the above, I can use JPA to achieve object relational mapping. However, the xDate attribute can only store dates, e.g. dd/MM/yyyy. How do I refactor the above to store a full date object using just one field, i.e. dd/MM/yyyy HH24:mm?

    Read the article

  • Surrogate key for date dimension?

    - by Navin
    There are 2 school of thoughts : Use surrogate key preferbly in the format of YYYYMMDD as this will always be sequential. Eliminate Date dimension surrogate key and use actual date instead. My Questions to experts on dimension modeling are : 1> Which design would you prefer and why ? 2> How should we handle unknown values in each of the cases, Can we simply place NULL in Fact table for unknown dates as Foreign Key can be NULL (if no why)? 3> If we need to partition fact table on date column ,how would we achieve that in case 1. I am inclined towards using actual date and using NULL to represent UNKNOWN dates in fact table , as date related validation on fact can be done without need to look in to dimension table.

    Read the article

  • jQuery.param() - doesn't serialize javascript Date objects?

    - by ehahn9
    jQuery.param({foo: 1}); // => "foo=1" - SUCCESS! jQuery.param({bar: new Date()}); // => "" - OUCH! There is no problem with encodeURIComponent(new Date()), which is what I would have thought param is calling for each member. Also, explicitly using "traditional" param (e.g. jQuery.param(xxx, true)) DOES serialize the date, but alas, that isn't of much help since my data structure isn't flat. Is this because typeof(Date) == "object" and param tries to descend into it to find scalar values? How might one realistically serialize an object that happens to have Date's in it for $.post() etc.?

    Read the article

  • Select a row having a column with max value - On a date range

    - by Abhi
    Excuse me for posting a similar question. Please consider this: date value 18/5/2010, 1 pm 40 18/5/2010, 2 pm 20 18/5/2010, 3 pm 60 18/5/2010, 4 pm 30 18/5/2010, 5 pm 60 18/5/2010, 6 pm 25 19/5/2010, 6 pm 300 19/5/2010, 6 pm 450 19/5/2010, 6 pm 375 20/5/2010, 6 pm 250 20/5/2010, 6 pm 310 The query is to get the date and value for each day such that the value obtained for that day is max. If the max value is repeated on that day, the lowest time stamp is selected. The result should be like: 18/5/2010, 3 pm 60 19/5/2010, 6 pm 450 20/5/2010, 6 pm 310 The query should take in a date range like the one given below and find results for that range in the above fashion: where date = to_date('26/03/2010','DD/MM/YYYY') AND date < to_date('27/03/2010','DD/MM/YYYY')

    Read the article

  • Setting date from selectInputDate to object

    - by DD
    I have a date controller which does various things. Once a calendar date is set, I want to pass the value from the date controller to another bean. The problem I have is that the setPropertyActionListener gets called before the user clicks on a date. Is there a way to get the date from the selectInputDate after selection and pass to a bean? This is what I tried: <ice:selectInputDate popupDateFormat="dd-MMM-yyyy" renderAsPopup="true" value="#{dateRangeDateContoller.end}" > <f:setPropertyActionListener target="#{searchParameters.endDate}" value="#{dateRangeDateContoller.end}" /> </ice:selectInputDate>

    Read the article

  • DateTimeAxis - set Label to display Date + Time

    - by Jay
    Hi, Is there a way in flex 3 chart component to display both the date and time using horizontal DateTimeAxis? Currently the DateTimeAxis element has an attribute dataunits which allows to set the value to any of "milliseconds|seconds|minutes|hours|days|weeks|months|years" but I want to display the label as "2009/09/15 06:00:00" which includes the day and the time too. Here is the sample that i'm using [Bindable] public var deck:ArrayCollection = new ArrayCollection([ {date:"2009-09-15 06:00:00", close:42.71}, {date:"2009-09-16 06:15:00", close:42.99} ]); public function myParseFunction(s:String):Date { var sDate = s.substring(0,s.indexOf(" ")); var sTime = s.substring(s.indexOf(" ")); var aDate = sDate.split("-"); var aTime = sTime.split(":"); return new Date(aDate[0],(aDate[1]*1-1),aDate[2],aTime[0],aTime[1],aTime[2],0); } ]] Thanks in advance.

    Read the article

  • How to strore Java Date to Mysql datetime...?

    - by user275843
    can any body tell me how can i store Java Date to Mysql datetime...? when i am trying to do so...only date is stored and time remain 00:00:00 in mysql date stores like this... 2009-09-22 00:00:00 i want not only date but also time...like 2009-09-22 08:08:11 please help me.... EDIT---- i am using JPA(Hibernate) with spring mydomain classes uses java.util.Date but i have created tables using handwritten queries... this is my create statement CREATE TABLE ContactUs (id BIGINT auto_increment, userName VARCHAR(30), email VARCHAR(50), subject VARCHAR(100), message VARCHAR(1024), messageType VARCHAR(15), contactUsTime datetime, primary key(id))TYPE=InnoDB;

    Read the article

  • How to change the date format in JavaScript?

    - by Nitz
    Hey Guys I am using one jquery date picker, with using picker i am getting date in like this format Friday, May 21, 2010 Now i want to add one day in this date so i think, i can only do if i change the date in exact format like 21/5/2010 I want to only convert that bcz i want to add one day to the particular date. So what do u suggest me? How can I do that? Can i do without converting it ? thanks in advance....

    Read the article

  • python + auto ssh proccess to get date info

    - by david
    I need to perform on my linux 5.3 ssh [Linux machine red hat 5.3] date in order to get the date results , during ssh need to answer on the following question (yes/no)? -- yes password: -- diana_123 and then I will get the date results please advice how to do this automated process with python? ( on my Linux I have Python 2.2.3 ) python script should get the IP address number , and perform automatically ssh to 103.116.140.151 and return the date results as --> Fri Nov 18 11:25:18 IST 2011 example of manual proccess: # ssh 103.116.140.151 date The authenticity of host '103.116.140.151 (103.116.140.151)' can't be established. RSA key fingerprint is ad:7e:df:9b:53:86:9f:98:17:70:2f:58:c2:5b:e2:e7. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '103.116.140.151' (RSA) to the list of known hosts. [email protected]'s password: Fri Nov 18 11:25:18 IST 2011

    Read the article

  • MySQL Query, Date Range From "Blacklist"

    - by erbaker
    I have 2 databases. One is properties and the other is dates. In dates I have associated the land_id and a date (In YYYYMMDD format) which means that the date is not available. I need to formulate a query that a user can specify a start and end date, and then choose a property for which dates are available (not in the date database). How do airline and hotel websites do this kind of logic? I was thinking about taking the date range and picking all days in between and doing a query where the dates do not match and ordering it by number of results, but I can see how that could easily turn into an intense query. CREATE TABLE IF NOT EXISTS `dates` ( `id` int(11) NOT NULL AUTO_INCREMENT, `land_id` int(11) NOT NULL, `date` varchar(255) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=44 ; -- -- Dumping data for table `dates` -- INSERT INTO `dates` (`id`, `land_id`, `date`) VALUES (43, 1, '20100526'), (39, 1, '20100522'), (40, 1, '20100523'), (41, 1, '20100521'), (42, 1, '20100525');

    Read the article

  • Windows batch/script code to conditionally process based on date value in text file

    - by CarolinaJay65
    I am using Windows XP. The code can be used in a batch file or vbs script. I intend to use Windows scheduler to run the program. I need code to read a date from a text file (could be the only line in the text file or the date could be included in the filename, I control the process that generates the file) The code would then need to evaluate the text file date against the current date to confirm that the text file date is from the prior month. I'm starting to build a process to be able to run 1st-of-the-month jobs once the monthly data has been refreshed. I'm new to building this kind of process using batch/script files. Thanks for your time

    Read the article

  • Pre-Populated Date in Text Field

    - by user2537332
    I am trying to pre-populate a text box with today's date, but for some reason, it keeps showing today's date as 5/30/13, which is a month behind. This code should just be pulling the local time so why is it a month behind? Here is my code, can someone please tell me why the current date is off...Please help, :) var dateToday=new Date(); function loadDate(){ var today=dateToday.getMonth() + "/" +dateToday.getDate()+"/"+dateToday.getFullYear(); document.forms[0].curDate.value=today; } function orderReady(orderTime){ dateToday.setDate(dateToday.getDate()+orderTime); var ready=dateToday.getMonth()+"/" +dateToday.getDate()+"/"+dateToday.getFullYear(); document.forms[0].puDate.value=ready; } <body onload="loadDate();"> <p>Today's Date<br /> <input type="text" name="curDate" size="50" /><br />

    Read the article

  • compare date split across colums

    - by alex-tech
    Greetings. I am querying tables from Microsoft SQL 2008 which have date split across 3 columns: day, month and year. Unfortunately, I do not have control over this because data is coming in to the database daily from a 3rd party source in that format. I need to add between to a where clause so user can pull records within a range. Would be easy enough if date was in a single column but finding it nearly impossible when its split across three columns. To display the date, I am doing a CAST( CAST(year as varchar(4)) + '-' + CAST(month as varchar(2)) + '-' + CAST(day as varchar(2)) as date) AS "date"` in a select. I tried to put it as a parameter for datediff function or just the regular between but get no results. Thanks for any help.

    Read the article

  • Read video information(date created)?

    - by Lynx
    In window, i can get the date created of the video from properties(right click). I have a few idea on this but i dont know how to do it. 1. Get the video information directly from video(like in windows), 2. By extracting the video name to get the date created(The video's name is in date format, which is the time it created). And i also using taglib-sharp to get the video duration and resolution, but i cant find any sample code on how to get the video creation date. Note: video name in date format - example, 20121119_125550.avi Edit Found this code and so far its working string fileName = Server.MapPath("//video//20121119_125550.avi"); FileInfo fileInfo = new FileInfo(fileName); DateTime creationTime = fileInfo.CreationTime; Output: 2012/11/19 12:55:50 For the file's name, i will add another string in name. For example User1-20121119_125550.avi.avi, so it will get complicated after that.

    Read the article

  • HandsOnTable - using date functions with methods

    - by briansol
    I have a function used on the datepicker to limit dates selected to the first of the month... I invoke it by setting a class and listener, such as: $( ".datepickfom" ).datepicker( { beforeShowDay: fom, showOn: "both", buttonImage: "/images/calendar.png", buttonImageOnly: true, changeMonth: true, changeYear: true, dateFormat: "m/d/yy", yearRange: "-25:+100", constrainInput: true } ); the fom call: function fom(date){ if (date.getDate() != 1) { return [false, "", "Specify 1st of Month"]; } return [true, ""]; } This works great for regular forms. I'm looking to extend this functionality to the HandsOnTable 'date' cell data types. var $container_1 = $("#datatable_1"); var handsontable_1 = $container_1.data('handsontable'); $("#datatable_1").handsontable( { columns: [ {}, {}, { type: 'date', dateFormat: 'm/d/yy' }, {}, { type: 'dropdown', source: ["","Y","N"] }, {}, {} ] }); This also works as it should, but the date lets me pick other dates besides the first. Is there a way to attach the beforeShowDay option to the HOT cell call as well?

    Read the article

  • mktime and date questions..

    - by mjboggess
    Hello SO! I am working on a small project and am playing with date() and mktime() in PHP. Compare the two code blocks and their output, notice the second sample adds one to the month in it's first mktime. $monthis = 5; echo date('F', mktime(0,0,0,$monthis,0,0)) . " 1, 2010 is on a " . date("l F", mktime(0, 0, 0, $monthis, 1, 2010)); puts out April 1, 2010 is on a Saturday May but if I change it to $monthis = 5; echo date('F', mktime(0,0,0,$monthis + 1,0,0)) . " 1, 2010 is on a " . date("l F", mktime(0, 0, 0, $monthis, 1, 2010)); puts out May 1, 2010 is on a Saturday May Why do I have to add one to the month in the first mktime so that both emit the same month? Any help or clarity would be appreciated. Thanks :)

    Read the article

  • Show the specific field on mysql table based on active date

    - by mrjimoy_05
    Suppose that I have 3 tables: A) Table UsrHeader ----------------- UsrID | UsrName ----------------- 1 | Abc 2 | Bcd B) Table UsrDetail ------------------------------- UsrID | UsrLoc | Date ------------------------------- 1 | LocA | 10 Aug 2012 1 | LocB | 15 Aug 2012 2 | LocA | 10 Aug 2012 C) Table Trx ----------------------------- TrxID | TrxDate | UsrID ----------------------------- 1 | 10 Aug 2012 | 1 2 | 16 Aug 2012 | 1 3 | 11 Aug 2012 | 2 What I want to do is to show the table like: --------------------------------------- TrxID | TrxDate | UsrID | UsrLoc --------------------------------------- 1 | 10 Aug 2012 | 1 | LocA 2 | 16 Aug 2012 | 1 | LocB 3 | 11 Aug 2012 | 2 | LocA Notice that there is one user but different location. That's based on the UsrDetail table that the user on a specified date has moved to another location. So, it should be show the user specific location on that date on every transaction. I have try this code but it is no luck: SELECT trx.TrxID, trx.TrxDate, trx.UsrID, User.UsrName, User.UsrLoc FROM trx INNER JOIN ( SELECT UsrHeader.UsrID, UsrHeader.UsrName, UserDetail.UsrLoc FROM UsrHeader INNER JOIN ( SELECT UsrDetail.UsrID, UsrDetail.UsrLoc, UsrDetail.Date FROM UsrDetail ) AS UserDetail ON UserDetail.UsrID = UsrHeader.UsrID ) AS User ON User.UsrID = trx.UsrID AND trx.TrxDate >= User.Date How to do that? Thanks..

    Read the article

  • Gnome 3 - Unable to change date and time

    - by Chris Harris
    I am running Arch Linux with Gnome 3. Unfortunately, although my time and date settings in /etc/rc.conf show that HARDWARECLOCK='UTC' and TIMEZONE='America/LosAngeles'. I continue to get the timezone of Europe/London. If I try to change the date and time via the GUI. It requires root access. After authorizing root access, the date and time may be changed; however, after closing the GUI window, it automatically reverts back to the previous incorrect timezone. I am able to use pool.ntp.org in order to sync my time to the correct one; however, this works only for the current session and is not fixed. This solution is inconvenient since there is not always network access. What other solutions are available for this problem?

    Read the article

  • Excel Countif external date

    - by Duall
    I am making an Excel 2010 spreadsheet to log support calls, services, and installations that each member would fill out. Due to being paid by job rather than by hour, there is a need for it to count each of these ("Call", "Service", "Install") there is in any given time span. The entry of the data itself would be in Sheet 1, and then a 'splash screen' of sorts would be in Sheet 2. Here I would like to be able to put a date range and it would display how many of each there is. I already can do the COUNTIF statement, =COUNTIF(Activity!$B:$B,"Call") but I don't know how to: a) Add in the prerequisite for a date so it only gets "Calls" within a certain time frame. b) Take the date it looks for from a cell on the splash screen.

    Read the article

  • excel date range help please

    - by Mark
    I need help with either a formula or a macro to help automate a grade sheets dates. We have class every monday or wednesday only. I would like to vlookup from a input table of each quarters date range (example Sept. 10 - Oct 24 and the code auto insert the date of every monday and wednesday in a row at the top of my grade sheet. Every year I use the same excel workbook I built to average and rate the grading with no problem, however i can't seem to get this one right. Any help would be greatly appreciated. Currently I have to enter each date by hand. Thanks Again for any help.

    Read the article

  • Django Form for date range

    - by gramware
    I am trying to come up with a form that lets the user select a date range to generate a web query in Django. I am having errors getting the date to filter with in my view, I am unable to strip the date. Here is my forms.py class ReportFiltersForm(forms.Form): start_date = forms.DateField(input_formats='%Y,%m,%d',widget=SelectDateWidget()) end_date = forms.DateField(input_formats='%Y,%m,%d',widget=SelectDateWidget()) And my view if request.method == 'POST': form = ReportFiltersForm(request.POST) sdy = request.POST['start_date_year'] sdm = request.POST['start_date_month'] sdd = request.POST['start_date_day'] edy = request.POST['end_date_year'] edm = request.POST['end_date_month'] edd = request.POST['end_date_day'] start_date= datetime.date(sdy, sdm, sdd) end_date= datetime.date(edy, edm,edd) Traceback Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/django/core/servers/basehttp.py", line 651, in __call__ return self.application(environ, start_response) File "/usr/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 241, in __call__ response = self.get_response(request) File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 134, in get_response return self.handle_uncaught_exception(request, resolver, exc_info) File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 154, in handle_uncaught_exception return debug.technical_500_response(request, *exc_info) File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py", line 92, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/home/projects/acms/cms/views.py", line 470, in eventreports start_date= datetime.date(sdy, sdm, sdd) TypeError: an integer is required

    Read the article

  • Saturated addition of two signed Java 'long' values

    - by finnw
    How can one add two long values (call them x and y) in Java so that if the result overflows then it is clamped to the range Long.MIN_VALUE..Long.MAX_VALUE? For adding ints one can perform the arithmetic in long precision and cast the result back to an int, e.g.: int saturatedAdd(int x, int y) { long sum = (long) x + (long) y; long clampedSum = Math.max((long) Integer.MIN_VALUE, Math.min(sum, (long) Integer.MAX_VALUE)); return (int) clampedSum; } or import com.google.common.primitives.Ints; int saturatedAdd(int x, int y) { long sum = (long) x + (long) y; return Ints.saturatedCast(sum); } but in the case of long there is no larger primitive type that can hold the intermediate (unclamped) sum. Since this is Java, I cannot use inline assembly (in particular SSE's saturated add instructions.) It can be implemented using BigInteger, e.g. static final BigInteger bigMin = BigInteger.valueOf(Long.MIN_VALUE); static final BigInteger bigMax = BigInteger.valueOf(Long.MAX_VALUE); long saturatedAdd(long x, long y) { BigInteger sum = BigInteger.valueOf(x).add(BigInteger.valueOf(y)); return bigMin.max(sum).min(bigMax).longValue(); } however performance is important so this method is not ideal (though useful for testing.) I don't know whether avoiding branching can significantly affect performance in Java. I assume it can, but I would like to benchmark methods both with and without branching. Related: http://stackoverflow.com/questions/121240/saturating-addition-in-c

    Read the article

  • Multiplication algorithm for abritrary precision (bignum) integers.

    - by nn
    Hi, I'm writing a small bignum library for a homework project. I am to implement Karatsuba multiplication, but before that I would like to write a naive multiplication routine. I'm following a guide written by Paul Zimmerman titled "Modern Computer Arithmetic" which is freely available online. On page 4, there is a description of an algorithm titled BasecaseMultiply which performs gradeschool multiplication. I understand step 2, 3, where B^j is a digit shift of 1, j times. But I don't understand step 1 and 3, where we have A*b_j. How is this multiplication meant to be carried out if the bignum multiplication hasn't been defined yet? Would the operation "*" in this algorithm just be the repeated addition method? Here is the parts I have written thus far. I have unit tested them so they appear to be correct for the most part: The structure I use for my bignum is as follows: #define BIGNUM_DIGITS 2048 typedef uint32_t u_hw; // halfword typedef uint64_t u_w; // word typedef struct { unsigned int sign; // 0 or 1 unsigned int n_digits; u_hw digits[BIGNUM_DIGITS]; } bn; Currently available routines: bn *bn_add(bn *a, bn *b); // returns a+b as a newly allocated bn void bn_lshift(bn *b, int d); // shifts d digits to the left, retains sign int bn_cmp(bn *a, bn *b); // returns 1 if a>b, 0 if a=b, -1 if a<b

    Read the article

  • Persisting Joda DateTime instead of Java Date in hibernate

    - by Tauren
    My entities currently contain java Date properties. I'm starting to use Joda Time for date manipulation and calculations quite frequently. This means that I'm constantly having to convert my Dates into Joda DateTime objects and back again. So I was wondering, is there any reason I shouldn't just change my entities to store Joda DateTime objects instead of Java Date objects? Please note that these entities are persisted via Hibernate. I found the jodatime-hibernate project, but I also was reading on the Joda mailing list that it wasn't compatible with newer versions of hibernate. And it seems like it isn't very well maintained. So I'm wondering if it would be best to just continue converting between Date and DateTime, or if it would be wise to start persisting DateTime objects. My concern is being reliant on a poorly maintained library. Edit: Note that one of my objectives is to be better able to store timezone information. Storing just a Date appears to save the date in the local timezone. As my application can be used globally, I need to know the timezone as well. Joda Time Hibernate seems to address this as well in the user guide.

    Read the article

< Previous Page | 31 32 33 34 35 36 37 38 39 40 41 42  | Next Page >