datetime

Parsing dates to a Rails friendly format

I've got a batch of a 100k or so records that I'm importing to a Rails app. There's a date in each row formatted like the following: 03/17/81 However, when I try to just assign it to a date field, it gets converted as follows: ruby-1.8.7-p174 > "03/17/81".to_date => Sat, 17 Mar 0081 Ultimately I would like the format to result in ...

String.FormatException with DateTime in non US Culture

I am getting a String.FormatException trying to convert/parse a string when the culture is other than non-US. The odd thing is that the string was generated by applying the very same format and culture as those being used to parse it back into a string. In the code below, all of these versions will fail: const string culture = "ja-JP...

RSS time format to human readable format

I'm using MagpieRSS to parse some Craigslist feeds. The problem is the publish dates for craigslist posts are in this format: 2010-02-25T18:09:38-06:00 How can I convert that to Thursday, February 25, 2010 6:09 PM using php? ...

Problem displaying DayOfWeek in MVC 1.0

Hi, I have an ascx page which contains the following line: <%= Html.TextBox("DayOfWeek", Model.JourneyBooking.StartDate.DayOfWeek.ToString(), new { @readonly = "readonly", style = "width:90px" })%> This is inside an .ascx page and when display it inside a jQuery dialog popup the textbox shows '5' as the contents. This should show Fr...

Converting to date in PHP from yyyymmdd format

I have dates in the following format (yyyymmdd, 18751104, 19140722)... what's the easiest way to convert it to date().... or is using mktime() and substrings my best option...? ...

Is there a standard date/time format that can be passed on a URL?

Looking at the DateTimeFormatInfo documentation, it appears that all the standard formats have colons in them, which makes passing them on a url unpleasant/impossible. Is there a standardized format for passing a datetime on a url, preferably one that can be automatically parsed by .NET? Update: A little clarification The consumer o...

Compare date in php

Task: I need to check the current time with a respective time fixed by the admin, if the current time crosses the respective time, will update status 1) How can i convert the respective date to unix timestamp ? TIME STAMP: 1267285500 for DATE: 2 / 27 / 2010 @ 9:45:0 so that i can compare the unix timestamps of the current time and ...

int to string to date

hello i have a question, i use asp.net i have a int (10112009) in the end i want a date formate like day- day / month month / yyyy what's the best way (or a way) to do that? thanks ...

Android compare datetime

I'm trying to compare two datetimes but I can't get it to work. public void time () { Calendar c11 = Calendar.getInstance (); c11.add(Calendar.DAY_OF_YEAR, 0); c11.set(Calendar.HOUR_OF_DAY, 9); c11.set(Calendar.MINUTE, 0 ); c11.set(Calendar.SECOND, 0); Calendar c12 = Calendar.getInsta...

Is there a Windows absolute time for timestamps? (.NET)

I'm working with a WPF/C# app where I need to lock out users from accessing a particular feature for some amount of time. Basically, from the time a certain event happens, I want to prevent certain access for the next 24 hours. The simple case: Event happens, save timestamp (using DateTime or similar) User tries to access area 15 hou...

Is there a simple conversion for this datetime format?

I'm retrieving data from a JSON feed using jQuery and as part of the feed I'm getting 'datetime' attributes like "2009-07-01 07:30:09". I want to put this information into a javascript Date object for easy use but I don't believe the Date object would recognize this kind of format if I simply plugged it into the constructor. Is there a...

Attempting to insert an integer from a list into datetime object...

Hi all, What I am trying to accomplish is very simple: creating a loop from a range (pretty self explanatory below) that will insert the month into the datetime object. I know %d requires an integer, and I know that 'month' type is int...so I'm kind of stuck as to why I can't substitute my month variable. Here is my code: all_months=...

Query by age in hql

I have a class User with one field called birthDate which is a java.sql.Date. How do I do a hql query that will retrieve all Users that are between min and max years old? (My real scenario is slightly more complex than that but that's where I am stuck right now). UPDATE It must be an hql expression so I can put the age expression in a...

Override DateTime.MinValue

I am using Datetime.Minvalue which return 1.1.0001. This value can not be stored to DB because year is smaller than 1975. Is it possible to override DateTime.Minvalue to 1.1.1901? Regards ...

Is there a way to access datetime constants in Kohana 3?

Before I used a framework, I'd often define things like so (so my code makes more sense to read) define('MINUTE', 60); define('HOUR', MINUTE * 60); // etc Is anything like this built into Kohana 3, or should I specify this myself (perhaps in bootstrap.php)? ...

Time Dependent, How?

I have a database, which is a part of a Library Information system. It keeps track of the books borrowed by customers, keeping the due dates and automating the notification of accountability of customers, if a customer returned a book beyond their due date. Now, I am using MySQL for the DBMS. What I know is that MySQL's time is depende...

Converting date to this format

I have a date in this format: 24-12-2010 // DAY - MONTH - YEAR I need to get it in this format: 1995-12-31T23:59:59.999Z // The Z is for the TimeZone I think. Check this link out: http://lucene.apache.org/solr/api/org/apache/solr/schema/DateField.html The above link is the way I need the date. I am using PHP now, so this n...

Algorithm to check whether a certain hour falls into a given time period

Assume I've got a start and stop hour in which some processing should take place: Start 20:00 End 07:00 Now what is the best algorithm to check if a certain DateTime hour value falls within this range? Thanks in advance! Please note that the start and end times mentioned above indicate that we are dealing with an "overnight-job". Mean...

date format and regional settings

Hi all, I'm using MS SQL 2000, VS2008, MVC and C#. I'm trying to insert and update some data using stored procedures. Some columns are of type datetime. Regional settings on both server and client are set to Dutch (Belgium) This means the default date format is dd/mm/yyyy. When i try to insert or update with a date of eg. 28/03/2009,...

Timezone lookup

Hello everyone, I have a file that contains the following in a csv file; country,region,city,postalCode,metroCode,areaCode I need to find the time zone for the entries. I have seen olson database and geonames, i was lost with olson database. couldnt find anything useful. is there any web site i can access the time zone information ba...