datetime

Data-bound WinForms form - how to format dates?

I have a form with a date value in a TextBox control. The form uses data binding with a BindingSource against a DataSet and a SQL 2005 CE database. Where do I control the formatting of the date? Nowhere in the properties along the way did I see a possibility to strip out the time part, for instance. I could of course do it in the databa...

Simplest way to increment a date in PHP?

Say I have a string coming in, "2007-02-28", what's the simplest code I could write to turn that into "2007-03-01"? Right now I'm just using strtotime(), then adding 24*60*60, then using date(), but just wondering if there is a cleaner, simpler, or more clever way of doing it. ...

What is the range of times that Ruby's Time class can represent?

Times farthest in the past and farthest in the future that can be represented? Is it absolute moments in time, or distance in time from the present moment? I couldn't find it in the docs for the Time class. Does it depend on the system? If so, how can I access it in my code? UPDATE After some experimentation, I found that it's from ...

What datetime format is this?

I have DateTime structure for an old data format that I don't have access to any specs for. There is a field which indicates the datetime of the the data, but it isn't in any format I recognize. It appears to be stored as a 32-bit integer, that increments by 20 for each day. Has anyone ever run across something like this? EDIT: Exam...

Parsing JSON DateTime from Newtonsoft's JSON Serializer

I've serialized an object using Newtonsoft's JSON serializer, and the DateTime has come through as: /Date(1237588418563+0000)/ When I $.evalJSON() on that, it is an object but I can't find any normal Date methods like toUTCString on it. Any ideas what I can do with this? ...

DATETIME - three hours behind timezone

Hey, I am using DATETIME as a column type and using NOW() to insert. When it prints out, it is three hours behind. What can I do so it works three hours ahead to EST time? I am using php date to format the DATETIME on my page. Thanks, Ryan ...

date regex

i am trying to validate a date in c# in the format "yyyy/mm/dd". is it even possible (using regex) to validate that there aren't 30 days in february? ...

How to create a friendly date format (for example "submitted 2 days ago"

I'm meaning to format dates on my social web app much like Digg.com and other sites do. There, you see very friendly dates, such as: just now 3 minutes ago one hour ago 2 weeks ago 6 monts ago ...you get the idea. Before I wrap my head around creating such a thing, does anyone know of any ready-to-go script for this where I simply in...

Class in the BCL that will event at a given DateTime?

Is there an object that will event at a given DateTime or DateTimeOffset? I am using a Timer to do this operation now but it requires a bit of calculation on my part, was just thinking there might already be something in place. ...

Javascript Datejs

I was looking through some pages when I stumbled across this open source JavaScript date library: Datejs. Now I've been trying to use it but everytime I try any function like: $(function() { Date.today().toLongDateString() } ); or even only Date.today().toLongDateString() withing tags, I get errors when the webpage loads, it tells...

Age in years from DateTime (Date of birth)

Duplicate How Can I calculate Someone's Age in C#? I have a datetime variable that represents the date of birth of a user. How can I get the age in years from this? Update I want a precise birthday, so 30.45 years or something. ...

Age in years with decimal precision given a datetime

Hi, How can I get the age of someone given the date of birth in a C# datetime. I want a precise age like 40.69 years old ...

Ruby: Mysql timestamp/datetime problem

Is there solution for '0000-00-00 00:00:00' problem, without changing table? I have "[]" in this query: dbh.select_all("select j.n, j.name, j.dsc, j.flag, j.td from job j where j.td='0000-00-00 00:00:00'") I look solution for this: http://rubyforge.org/tracker/index.php?func=detail&aid=22243&group_id=234&atid=967 ...

How to convert 1400-1500 to 2pm - 3pm?

I am receiving data representing a time slot from a service as a string in the form of: 1500-1600 This meaning 3pm to 4pm. I will have a list of these e.g. 1200-1300 1300-1400 1400-1500 and I have to represent this in the UI as 12pm - 1pm 1pm - 2pm 2pm - 3pm Unfortunately this list could be in a ran...

How to calculate the date difference between 2 dates using php

Hi, I have to dates of the form Start Date: 2007-03-24 End Date: 2009-06-26 Now I need to find the difference between these two in the below form: 2 years, 3 months and 2 days Can someone please help me with this ...

Select Distinct Years and Months for Django Archive Page

I want to make an archive_index page for my django site. However, the date-based generic views really aren't any help. I want the dictionary returned by the view to have all the years and months for which at least one instance of the object type exists. So if my blog started in September 2007, but there were no posts in April 2008, I cou...

How to display accurate times for testing performance numbers in C#

Hi, I want to test the speed of an algorithm, what DateTime overload will give me the most precise time? (I still need day/month/year/seconds but then I want milliseconds also). ...

How do i convert HH:MM:SS into just seconds using C#.net?

Is there a tidy way of doing this rather than doing a split on the colon's and multipling out each section the relevant number to calculate the seconds? ...

How to check an UTC formatted date with a regular expression?

As you know the format is like: "YYYY-MM-DDTHH:NN:SS.ZZZ+XX:XX" (i.e. "2009-03-24T16:24:32.057+01:00") I have to do it in a ActionScript3 class but any source will be appreciated, thanks. ...

Python, Convert 9 tuple UTC date to MySQL datetime format

I am parsing RSS feeds with the format as specified here: http://www.feedparser.org/docs/date-parsing.html date tuple (2009, 3, 23, 13, 6, 34, 0, 82, 0) I am a bit stumped at how to get this into the MySQL datetime format (Y-m-d H:M:S)? ...