datetime

Compare date from database using parameters

string queryString = "SELECT SUM(skupaj_kalorij)as Skupaj_Kalorij " + "FROM (obroki_save LEFT JOIN users ON obroki_save.ID_uporabnika=users.ID)" + "WHERE (users.ID= " + a.ToString() + ") AND (obroki_save.datum= @datum)"; using (OleDbCommand cmd = new OleDbCommand(queryString,database)) ...

finding if an anniversary is coming up in n days in MySql

I have a table with anniversary dates. I want a query that returns me rows of anniversaries coming up in the next 10 days. For instance: birthdate --------- 1965-10-10 1982-05-25 SELECT birthdate FROM Anniversaries WHERE mystical_magical_mumbo_jumbo <= 10 +------------+ | birthdate | +------------+ | 1982-05-25 | +------------+ 1 ro...

Nothing happen on setting minDate in jquery datepicker?

Hey Guys, I written like this.. <script> $(function() { $('#from').datepicker({ defaultDate: "+5d", changeMonth: true, numberOfMonths:1 , minDate:"+0d", dateFormat: 'DD, MM d, y...

Python timezone issue?

im having troubles with parsing a feed and getting the time. i am using dateutil.parser from dateutil.parser import parse print updated, parse(updated ), parse( updated ).utcoffset() this should be a time in cali, output 2010-05-20T11:00:00.000-07:00 2010-05-20 11:00:00.000000-07:00 -1 day, 17:00:00 why is the offset -1 day 17 ho...

Is there a faster method to match an arbitrary String to month name in Java

Hello, I want to determine if a string is the name of a month and I want to do it relatively quickly. The function that is currently stuck in my brain is something like: boolean isaMonth( String str ) { String[] months = DateFormatSymbols.getInstance().getMonths(); String[] shortMonths = DateFormatSymbols.getInstance().getShortM...

WPF Edit hours and minutes of a DateTime

Hi ! I have 3 TextBoxes to edit a DateTime. What is important to notice is that those 2 TextBoxes are editing the hour and minutes of the first TextBox DateTime value. One to edit the Date and 2 to edit hour and minutes. How would you do that? The code below doesn't reflect the DateTime changes when editing the hour or minute, because i...

Time difference in seconds (as a floating point)

>>> from datetime import datetime >>> t1 = datetime.now() >>> t2 = datetime.now() >>> delta = t2 - t1 >>> delta.seconds 7 >>> delta.microseconds 631000 Is there any way to get that as 7.631000 ? I can use time module, but I also need that t1 and t2 variables as DateTime objects. So if there is an easy way to do it with datettime, that ...

mysql ORDER BY datetime type field not sorting as expected

I have a field in my database that stores the datetime that an item was added to the database. If I want to sort the items in reverse chronological order I would expect that doing ORDER by date_added DESC would do the trick. But this seems not to work. I also tried ORDER by UNIX_TIMESTAMP(date_added) but this still did not sort the resul...

What module(s) do I need to include to get 5.seconds to work in Ruby?

Because apparently require 'date' doesn't include the method hours or seconds etc: undefined method `hours' for 5:Fixnum (NoMethodError) Am I missing something? Is 5.seconds only something you can do in Rails? If so, what is the require statement I need to get this to work in a ruby script? ...

JavaScript date comparison

Why does the equality operator return false in the first case? var a = new Date(2010, 10, 10); var b = new Date(2010, 10, 10); alert(a == b); // <- returns false alert(a.getTime() == b.getTime()); // returns true Why? ...

Using EXSLT dates-and-times module in XSLT 1.0 yields unknown error

I added the EXSLT dates-and-times module in my XSLT 1.0 file by declaring: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" ... xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"> This doesn't affect my resulting page, but when I try to call the actual date with: <xsl:v...

PHP date function not accepting timezone change

Hello, I've set up a quick little test to understand and debug timezones between mySQL and PHP. Here's the page: http://dev.feedingo.com/test_dates.php The dates are being created in mySQL using NOW() in a datetime field. The initial problem I was trying to figure out is what timezone mySQL is using and how to sync it up with PHP. B...

Reverse Timezone offset

I have a timezone name and I want the name of the timezone double its offset. For instance, Asia/Dubai is +4, I want to reverse that to -4... and have it resolved to EDT Language: PHP Here's a sample of what it would look like: $timezone = "Asia/Dubai" $offset = $timezone->getOffset(); $offset 0 - $offset; $timezone = $offset->getTim...

C#: Return start and end of year given any month.

I need two or one (out) C# method that will take any datetime and return the start date of year and end date of year for that year. Not a homework (;-) ...

How to parse DateTime in this format? "Sun May 23 22:00:00 UTC+0300 2010"

Guys, This is a quick one, i wanna parse a date that comes in this format "Sun May 23 22:00:00 UTC+0300 2010" Is this a valid UTC DateTime? And how to parse it? I tried : DateTime newStartTime = DateTime.ParseExact(hdnNewStartTime.Value, "ddd MM dd HH:mm:ss UTC+0300 yyyy", CultureInfo.CurrentCulture); However, this didn't work, any...

Ruby time in 2009-02-17T05:00-07:00 format?

How do I print out a ruby time using the date-time format: 2009-02-17T05:00-07:00 Like Time.now.to_datetime_s ...

breaking datetime into constituent parts ASP.NET MVC form

hi guys, i have searched the web relentlessly for this and have not found anything - which is surprising because i would think it is such a common scenario! Basically, on my model i have a DateTime field which i wish the user to populate through a form. I am using the Html helper to render all other parts of the form (along with valida...

Get client timezone (not GMT offset amount) in JS

I need to determine the client timezone (e.g. CET, GMT, EST) in JS. Getting the offset is straightforward, but doesn't have all the info necessary to determine the TZ, at least not easily. I have a feeling it might be possible to use a combination of offset, whether DST is in use and in effect, etc. but I'm hoping someone else has done t...

Compare Created DateTime to DateTime.Today at 6pm, C#

In C# I need to compare the value of DateTime.Today /6pm, to a field that stores the Created DateTime. Basically there is certain functionality that is only accessible on the same day as the created day and then only till 6pm. The part I am not fully understanding is how to accurately represent 6pm on Today to compare against. Is ther...

Getting age in years in a SQL query

Hello I've been tasked with doing a few queries on a large SQL Server 2000 database. The query I'm having trouble with is "find the number of people between ages 20 and 40" How would I do this? My previous query to get a count of everyone looks like this: select count(rid) from people where ... (with the ... being irrelevant cond...