datetime

Start and End time using jquery

I need to enter the start date, start time, end date and end time in my asp.net MVC application. date fields are textbox and time fields are dropdown. How can i fill the time dropdowns using jquery.? Also i need to restrict the user to select the invalid time periods. For ex.: when the user selects 9:00 AM in start time dropdown, the ...

Set Zend_Date Month using User Input

I'm looking for a way to set the month of Zend_Date using a string from the user (could be Jan, January, etc). For example $month = strftime("%m", strtotime($month)); $date->set($month, Zend_Date::MONTH); Will get the month 'number', which then can be used to set the Zend_Date month. Is there a way to do that all with Zend_Date? ...

Rehydrating fluent nhibernate configured DateTime as Kind Utc rather than Unspecified

Is there a way in fluent nhibernate to map a DateTime to rehydrate my entity with DateTime.Kind set to Utc rather than unspecified? I'm currently persisting a DateTime that is Utc, but the Kind coming back is always Unspecified, throwing off my time. ...

How can I get the offset as a TimeSpan if I only have the time as a string, such as 09:00 AM

I have the string "9:00 AM". I would like to get the offset from midnight as a TimeSpan in C#? ...

Complex MySQL Timer

If we have a timer that starts from lets say CURRENT_TIMESTAMP - 1 Hour we can simply calculate the difference and return 3600 seconds have passed. But what if we want the timer to only count during certian times of the day and only lets say work during weekday or specified days. Look at the below code to see the Create statment to get...

LINQ to SQL lambda exp. OrderBy, Case When

Hi guys! Going to need your help on this one. I'm trying to OrderBy first reply datetime if present. If it's empty/null, it must order by topic datetime. I've ended up with the following expression, but it just doesn't seem to work :( return db.Topics .Where(t => t.ForumID == id) .OrderBy( t => t.Replies .OrderBy(r => r.AddDat...

How to parse the IIS response header "Date" in .NET

Hello, I'm performing an HttpWebRequest against an IIS server. One of the response headers is Date, which I'd like to parse. This is its value: "Sun, 11 Oct 2009 08:16:13 GMT" How do I parase this string? DateTime.Parse didn't quite work out well for me. Thanks! ...

Python: user friendly time format

Python: I need to show file modification times in "1 day ago", "two hours ago", format. Is there something ready to do that? It should be in english ...

c# Parse json Date?

I get a json date from a webservice that i need to parse manualy and the date looks like this: "Fri, 06 Nov 2009 00:00:00 -0800" How would i parse this into a datetime object? I guess i should use DateTime.ParseExact but what do i feed into it. ...

compare dates in C++

Hi, i have a file, 'date.txt' which has date in it. Like, Mon Oct 13 09:37:08 2009. Now i want to compare this date with system date. How can i compare dates in C++.? I used this code to get the contents from the file 'date.txt' string date; while ( inDateFile >>date) //inDateFile is an ifstream object cout<<date<<...

How to interpret the these time stamps?

I'm trying to parse the time stamps written in some xml files. Most to the time time stamps are something like 2009-07-22-07:00 but some times I find them something like 2009-07-22Z or 2009-07-22z. Kindly help me how to interpret these Zs and how to parse them. I thing these z or Z is related to the time zone. Any workarounds to parse th...

gmt or without gmt

this might be stupid question, but ill ask anyway. do i really need to implement gmt on site to get proper timestamp on a post? well im building a site like twitter. my feeds are working fine and showing me the time i need, like it shows "posted 11 minutes, posted yesterday, posted 5 days ago.. " just like this site, so i was thinking ...

Parsing a date string using java.text.SimpleDateFormat

I have a weird problem, I need to parse a date string that looks like 1997-02-14T00:00:00.0000000+05:30. The odd thing about the date string is the time zone information. It's +05:30 instead of the usual +0530. I have the basic format string ready, yyyy-MM-dd'T'HH:mm:ss.SSSSSSSZ which would have worked like a charm, if not for the TZ in...

Cast Date in Informix

I have never used Informix before and I'm trying to write a query that will return records over the last 365 days. Here is the query I have been trying to use: Select * from Visit where vis_mod_dt between today-365 and today; That returns no records even though I know that there is data for the last 365 days. I am guessing that the ...

SQL datetime value

I have data formatted "2009-07-17T00:00:00-05:00" in varchar variable. How can I convert this data to datetime field in MS SQL server using query or TSQL? ...

Optimizing alternatives to DateTime.Now

A colleague and I are going back and forth on this issue and I'm hoping to get some outside opinions as to whether or not my proposed solution is a good idea. First, a disclaimer: I realize that the notion of "optimizing DateTime.Now" sounds crazy to some of you. I have a couple of pre-emptive defenses: I sometimes suspect that those ...

Displaying timezones without using UTC

I've been reading up on how to do this all morning, and the general consensus is this: store your timestamps in UTC and calculate the offset from there. However, like most people, I am maintaining an existing codebase and I can't change the way we store our dates. At least, not in the allotted time frame. So my question is, can I safel...

Datetime with milliseconds in SAS: highest precision numbers out of nowhere

Can someone explain where the highest precision numbers in variables d4 to d7 came from? The SAS program: data foo; format d1-d7 datetime30.6; timestring = "23:59:59.997000000"; time = input(timestring,time18.); d1 = dhms(0,0,0,time); d2 = dhms('08DEC1981'd,0,0,time); d3 = dhms('31DEC2503'd,0,0,tim...

ms access date and time. Time must be 7:00 AM and user must not edit time.

I have a form where users input information for a test run on a particular date. This creates a table that i then link with another table based on the date and an ID. In this other table (filled by a form created by someone else) all of the times are 7:00 AM. Whoever created the form for that table did what I'm now asking about; since...

Easy way to determine leap year in ruby?

Is there an easy way to determine if a year is a leap year? ...