Search Results

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

Page 15/497 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • I need to calculate the date / time difference between one date time column

    - by Stringz
    Details. I have the notes table having the following columns. ID - INT(3) Date - DateTime Note - VARCHAR(100) Tile - Varchar(100) UserName - Varchar(100) Now this table will be having NOTES along with the Titles entered by UserName on the specified date / time. I need to calculate the DateTimeDifference between the TWO ROWS in the SAME COLUMN For example the above table has this peice of information in the table. 64, '2010-03-26 18:16:13', 'Action History', 'sending to Level 2.', 'Salman Khwaja' 65, '2010-03-26 18:19:48', 'Assigned By', 'This is note one for the assignment of RF.', 'Salman Khwaja' 66, '2010-03-27 19:19:48', 'Assigned By', 'This is note one for the assignment of CRF.', 'Salman Khwaja' Now I need to have the following resultset in query reports using MYSQL. TASK - TIME Taken ACTION History - 2010-03-26 18:16:13 Assigned By - 00:03:35 Assigned By - 25:00:00 More smarter approach would be TASK - TIME Taken ACTION History - 2010-03-26 18:16:13 Assigned By - 3 minutes 35 seconds Assigned By - 1 day, 1 hour. I would appreciate if one could give me the PLAIN QUERY along with PHP code to embed it too.

    Read the article

  • Can't parse a 1904 date in ARPA format (email date)

    - by Ramon
    I'm processing an IMAP mailbox and running into trouble parsing the dates using the mxDateTime package. In particular, early dates like "Fri, 1 Jan 1904 00:43:25 -0400" is causing trouble: >>> import mx.DateTime >>> import mx.DateTime.ARPA >>> mx.DateTime.ARPA.ParseDateTimeUTC("Fri, 1 Jan 1904 00:43:25 -0400").gmtoffset() Traceback (most recent call last): File "<interactive input>", line 1, in <module> Error: cannot convert value to a time value >>> mx.DateTime.ARPA.ParseDateTimeUTC("Thu, 1 Jan 2009 00:43:25 -0400").gmtoffset() <mx.DateTime.DateTimeDelta object for '-08:00:00.00' at 1497b60> >>> Note that an almost identical date from 2009 works fine. I can't find any description of date limitations in mxDateTime itself. Any ideas why this might be? Thx, Ramon

    Read the article

  • The woes of (sometimes) storing "date only" in datetimes

    - by Heinzi
    We have two fields from and to (of type datetime), where the user can store the begin time and the end time of a business trip, e.g.: From: 2010-04-14 09:00 To: 2010-04-16 16:30 So, the duration of the trip is 2 days and 7.5 hours. Often, the exact times are not known in advance, so the user enters the dates without a time: From: 2010-04-14 To: 2010-04-16 Internally, this is stored as 2010-04-14 00:00 and 2010-04-16 00:00, since that's what most modern class libraries (e.g. .net) and databases (e.g. SQL Server) do when you store a "date only" in a datetime structure. Usually, this makes perfect sense. However, when entering 2010-04-16 as the to date, the user clearly did not mean 2010-04-16 00:00. Instead, the user meant 2010-04-16 24:00, i.e., calculating the duration of the trip should output 3 days, not 2 days. I can think of a few (more or less ugly) workarounds for this problem (add "23:59" in the UI layer of the to field if the user did not enter a time component; add a special "dates are full days" Boolean field; store "2010-04-17 00:00" in the DB but display "2010-04-16 24:00" to the user if the time component is "00:00"; ...), all having advantages and disadvantages. Since I assume that this is a fairly common problem, I was wondering: Is there a "standard" best-practice way of solving it? If there isn't, have you experienced a similar requirement, how did you solve it and what were the pros/cons of that solution?

    Read the article

  • Insert date to database

    - by simon
    I'm trying to insert the current date to the database and i allways get the massage(when i pres the button on the form to save to my access database), that the data type is incorect in the conditional expression. the code: string conString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=C:\Users\Simon\Desktop\save.mdb"; OleDbConnection empConnection = new OleDbConnection(conString); string insertStatement = "INSERT INTO obroki_save " + "([ID_uporabnika],[datum],[ID_zivila],[skupaj_kalorij]) " + "VALUES (@ID_uporabnika,@datum,@ID_zivila,@skupaj_kalorij)"; OleDbCommand insertCommand = new OleDbCommand(insertStatement, empConnection); insertCommand.Parameters.Add("@ID_uporabnika", OleDbType.Char).Value = users.iDTextBox.Text; insertCommand.Parameters.Add("@datum", OleDbType.Char).Value = DateTime.Now; insertCommand.Parameters.Add("@ID_zivila", OleDbType.Char).Value = iDTextBox.Text; insertCommand.Parameters.Add("@skupaj_kalorij", OleDbType.Char).Value = textBox1.Text; empConnection.Open(); try { int count = insertCommand.ExecuteNonQuery(); } catch (OleDbException ex) { MessageBox.Show(ex.Message); } finally { empConnection.Close(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); } i tried to change the oleDbType.char to oleDbType.Dbdate and others but it doesnt work. I can save other stuff with that code but im stuck here when i wan't to save the date. Please help !

    Read the article

  • Django notification get date one accesses a link

    - by dana
    hi there, i'm making a notification system, so that a user in a virtual community to be announced when someone sends him a message, or starts following him (the follow relation is like a friend relation, but it is not necessarily reciprocal) my view function: def notification_view(request, last_checked): u = Relation.objects.filter(date_follow>Notification.objects.get(last_checked=last_checked)) v = Message.objects.filter(date>Notification.objects.get(last_checked=last_checked)) if u: notification_type = follow if notice_settings == receive_notification or notice_settings == only_follow following = u if v: notification_type = message if notice_settings == receive_notification or notice_settings == only_messages message = v return render_to_response('notification/notification.html', { 'following': following, 'message':message, }, context_instance=RequestContext(request)) the models.py: class NoticeType(models.Model): follow = models.ForeignKey(Relations, editable = False) message = models.ForeignKey(Messages) classroom_invitation = models.ForeignKey(Classroom) class Notification(models.Model): receiver = models.ForeignKey(User, editable=False) date = models.DateTimeField(auto_now=True, editable = False) notice_type = models.ForeignKey(NoticeType, editable = False, related_name = "notification_type") sent = models.BooleanField(default = True) last_checked = models.DateTimeField(auto_now=True, editable = False) class NotificationSettings(models.Model): user = models.ForeignKey(User) receive_notifications = models.BooleanField(default = True) only_follow = models.BooleanField(default = False) only_message = models.BooleanField(default = False) only_classroom = models.BooleanField(default = False) #receive_on_email = models.BooleanField(default = False) my problem is: i want last_checked to be the time when someone acceses a link (the notification link). How can i possibily save that time? how can i get it? thanks in avance!

    Read the article

  • linux bash script: set date/time variable to auto-update (for inclusion in file names)

    - by user1859492
    Essentially, I have a standard format for file naming conventions. It breaks down to this: target_dateUTC_timeUTC_tool So, for instance, if I run tcpdump on a target of 'foo', then the file would be foo_dateUTC_timeUTC_tcpdump. Simple enough, but a pain for everyone to constantly (and consistently) enter... so I've tried to create a bash script which sets system variables like so: FILENAME=$TARGET\_$UTCTIME\_$TOOL Then, I can just call the variable at runtime, like so: tcpdump -w $FILENAME.lpc All of this works like a champ. I've got a menu-driven .sh which gives the user the options of viewing the current variables as well as setting them... file generation is a breeze. Unfortunately, by setting the date/time variable, it is locked to the value at the time of creation (naturally). I set the variable like so: UTCTIME=$(/bin/date --utc +"%Y%m%d_%H%M%Z") What I really need is either a way to create a variable which updates at runtime, or (more likely) another way to skin this cat. While scouring for solutions, I came across a similar issues... like this. But, to be honest, I'm stumped on how to marry the two approaches and create a simple, distributable solution. I can post the entire .sh if anyone cares to review (about 120 lines)

    Read the article

  • T-SQL select where and group by date

    - by bconlon
    T-SQL has never been my favorite language, but I need to use it on a fairly regular basis and every time I seem to Google the same things. So if I add it here, it might help others with the same issues, but it will also save me time later as I will know where to look for the answers!! 1. How do I SELECT FROM WHERE to filter on a DateTime column? As it happens this is easy but I always forget. You just put the DATE value in single quotes and in standard format: SELECT StartDate FROM Customer WHERE StartDate >= '2011-01-01' ORDER BY StartDate 2. How do I then GROUP BY and get a count by StartDate? Bit trickier, but you can use the built in DATEADD and DATEDIFF to set the TIME part to midnight, allowing the GROUP BY to have a consistent value to work on: SELECT DATEADD (d, DATEDIFF(d, 0, StartDate),0) [Customer Creation Date], COUNT(*) [Number Of New Customers] FROM Customer WHERE StartDate >= '2011-01-01' GROUP BY DATEADD(d, DATEDIFF(d, 0, StartDate),0) ORDER BY [Customer Creation Date] Note: [Customer Creation Date] and [Number Of New Customers] column alias just provide more readable column headers. 3. Finally, how can you format the DATETIME to only show the DATE part (after all the TIME part is now always midnight)? The built in CONVERT function allows you to convert the DATETIME to a CHAR array using a specific format. The format is a bit arbitrary and needs looking up, but 101 is the U.S. standard mm/dd/yyyy, and 103 is the U.K. standard dd/mm/yyyy. SELECT CONVERT(CHAR(10), DATEADD(d, DATEDIFF(d, 0, StartDate),0), 103) [Customer Creation Date], COUNT(*) [Number Of New Customers] FROM Customer WHERE StartDate >= '2011-01-01' GROUP BY DATEADD(d, DATEDIFF(d, 0, StartDate),0) ORDER BY [Customer Creation Date]  #

    Read the article

  • Doing arithmetic and passing it to the next command

    - by neurolysis
    I know how to do this in /bin/sh, but I'm struggling a bit in Windows. I know you can do arithmetic on 32-bit signed integers with SET /a 2+2 4 But how do I pass this to the next command? For example, the process I want to perform is as follows. Consumer editions of Windows have no native automated sleep function (I believe?) -- the best way to perform a sleep is to use PING in association with the -n switch to get that many seconds, minus one, of sleep. The following command is effective for a silent sleep: PING localhost -n 3 > NUL But I want to alias this into a sleep command. I'd like to have it elegant so that you enter the actual number of seconds you want to sleep after the command, right now I can do DOSKEY SLEEP=PING 127.0.0.1 -n $1 > NUL Which works, but it's always 1 second less than your input, so if you wanted to sleep for one second you would have to use the command SLEEP 2. That's not exactly ideal. Is there some way for me to pass the arithmetic of $1+1 and pass it on to the next command in Windows? I assume there is some way of using STDOUT...

    Read the article

  • increment date by one month

    - by TIT
    hi let i have a date like it: 2010-12-11(year-mon-day) Now in php i want to increment it by one month. but when the month will be incremented, it will be automatically adjust years if needed. pls help. regards

    Read the article

  • Regex for date.

    - by Harikrishna
    What should be the regex for matching date of any format like 26FEB2009 30 Jul 2009 27 Mar 2008 29/05/2008 27 Aug 2009 What should be the regular expression for that ? Edit I have regex that matches with 26-Feb-2009 and 26 FEB 2009 with but not with 26FEB2009. So if any one know then please update it. (?:^|[^\d\w:])(?'day'\d{1,2})(?:-?st\s+|-?th\s+|-?rd\s+|-?nd\s+|-|\s+)(?'month'Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)[uarychilestmbro]*(?:\s*,?\s*|-)(?:'?(?'year'\d{2})|(?'year'\d{4}))(?=$|[^\d\w])

    Read the article

  • Date and Time Conversion in Ruby

    - by dkris
    I am currently looking on converting Thu Jun 10 16:17:55 +0530 2010 to 15/06/2010 or 15-06-2010 using Ruby I am getting the dates from the DB as shown below. @tickets = Ticket.find(:all) for ticket in @tickets print ticket.created_at end I have been looking around for resources as I a n00b in RoR/Ruby. I have looked at Class Date Class DateTime and couldn't make much of it. Please let me know how I could achieve this conversion in Ruby.

    Read the article

  • Using jQuery to find and then reformat a date string

    - by j-man86
    Hello, I currently am displaying dates as follows "yyyy/mm/dd" in a wordpress blog (it needs to be input in this format because a plugin is using it to define a post expiration date). I want to use jQuery to locate all of these strings on a page (they're all in table cells) and reformat them to "mm.dd.yy" The site is: http://www.beattrainsoundsystem.com/category/gigs The dates also exist in the footer on every page which I would also like to change. Thanks!

    Read the article

  • SQL CHECK constraint to prevent date overlap

    - by Michael
    I have a table that describes which software versions were installed on a machine at various times: machine_id::integer, version::text, datefrom::timestamp, dateto::timestamp I'd like to do a constraint to ensure that no date ranges overlap, i.e. it is not possible to have multiple software versions installed on a machine at the same time. How can this be achieved in SQL? I am using PostgreSQL v8.4.

    Read the article

  • App engine JPA date query

    - by waney
    Hi There. Assume I have object which represents TASK. Task have due date. How do I create query to get all tasks which are due today? Some working code like "select t from Task t where dueDate=:today" will be usefull. Thank you in advance.

    Read the article

  • Sharepoint 2007 calculated Date field shows incorrectly in non-US region

    - by Proforce
    If a SharePoint user (with Regional Settings set to UK) views a calculated date field in a View details form, the field shows incorrectly. I am using: ddwrt:FormatDateTime(string(@RenewalDate), 1033, 'dd MMMM yyyy') Which shows 04 January 2010 for 01/04/2010 and, doesnt show unresolvable dates such as 31-Dec-2010. This applies even with a simnple =[Modified] formula The Server is set up in the US for that locale.

    Read the article

  • how to add revision and build date to source

    - by gucki
    Hi! I have a gcc project and would like to automatically add defines for build date and revision number (from git) to my sources. What's the best way to do this? My goal is simple to be able to do something like this on startup: printf("Test app build on %s, revision %d", BUILD_DATE, REVISION) For building I'm using make with a simple Makefile.inc, not autoconf ot anything like this. Thanks, Corin

    Read the article

  • Jquery date in a adropdown with interval

    - by Zoom Pat
    I am trying to use Jquery to display dates in a dropdown with interval of half month... so the first value would be the coming month's 1st, then second will be the coming month's 15th and third value would be next to next month's first and so on... If today date is less than 15th then the first value would be the 15th of current month. What will be the best or a cleaner way to do this... (want to display in the dropdown) Thanks

    Read the article

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >