datetime

is there a smarter way to generate "time since" with a DateTime objects

i have this code to take a time in the past and generate a readable string to represent how long ago it was. I would have thought Timespan.Hours would give you hours even if its multiple daye in the past but it looks like it breaks it down into its seperate components (days, months, etc). How would i get total hours ago (even if its mo...

Calculating an End Date

I need a bit of help using symfony to calculate an end date. The user will select a start date, a frequency (Ex. Every 7 Days, Every 14 Days, Every Month, Semi-Annually - Every 6 Months, etc), and the number of occurrences. Examples: Start date: 08/01/2010 Frequency: Every 7 days Occurrences: 4 End Date = 08/29/2010 Start date: 08/01/...

convert 2010-04-15 23:59:59 to 15th Apr 2010

Hi, I have the following date format: 2010-04-15 23:59:59 How would I go about converting this into: 15th Apr 2010 using javascript ...

How to display converted time zones in a 'generic week' (Sunday thru Saturday)?

Hi, We are building a scheduling application wherein one user may set his "general availability" for all weeks like the following: Sunday | Monday | ... | Friday | Saturday When we ask a person A in India to indicate his "availability", we ask him to select from a drop down of values something like this: 12:00am 12:30am 01:00am ... ...

How to do a group by/count(*) pr year, month and day in django based on a datetime database field?

I have a table describing files with a datetime field. I want to somehow create a report that gives me the number of files grouped by each year, number of files grouped by each year and month and number of files grouped by each year, month and day. I just want records where count(*) > 0. Preferably using the ORM in django or if that`s no...

Find missing dates for a given range.

Hey, I'm trying to find missing dates between two DateTime variables for a collection of DateTimes. For example. Collection 2010-01-01 2010-01-02 2010-01-03 2010-01-05 DateRange 2010-01-01 -> 2010-01-06 would give me a List<DateTime> of 2010-01-04 2010-01-06 I can think of a few was of implementing this but nothing clean and sim...

sql ms access select by date and genre

I have two tables: fID Enamn Fnamn bdate 1 Ronge Paus 49-05-14 2 Nesser Håk 50-07-26 3 Bods Thomas 51-05-02 And ISBN cathegory 123 Prosa 456 Poesi 789 Thriller I am trying to select by date and cathegory. The writer shoult be born before year "1950" and the cathegory should be "Poesi" The result should be: ISBN ...

grails/mysql timezone change

Whats the best way to accomplish changing the timezone of an app? The way I see it the following must occur: Server TZ is changed by sys admin mysql must be restarted. every time based column in the database must have all values updated, using convert_tz or equivalent. So either a mysql script must be written or a grails script that ...

whats the best way to pass a full date time into a URL in asp.net mvc

i have a full datetime object that i need to pass in as a parameter in a URL. what is the best way to do this so it fully can get converted to a csharp DateTime object and not lose any precision ? ...

DateTime.Now.ToShortTimeString adds one hour to it mysteriously :S

I want to add the current date/time to an XML document So i use something like this XmlAttribute receivedDateTime = SettingsFile.CreateAttribute("ReceivedDateTime"); receivedDateTime.Value = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); Debug.WriteLine("Adding Date Time in addMessage method : " + Da...

Finding out the DateTimeFormat obtained when DateTime.ToString( ) is called.

I have the following issue with handling datetime formats for a component I am developing. string value = DateTime.Now.ToString( ); // value = "8/3/2010 2:20:49 PM" How do I find out which date format value refers to --> "M/d/yyyy h:mm:ss tt" I wish to store this current datetime format during export and use the same during import. V...

UTC - Working one day behind

I have an application which records statistics. When a user submits their statistics the information is stored and the date/time is recorded as UTC e.g. In the UK if I recorded figures at 03/08/2010 10:30 my recorded date/time would be 03/08/2010 09:30 as we are currently observing DST. If I was in say Australia, and I recorded my stat...

Different behaviour between formatting strings for TimeSpan and DateTime

Hi all! While coding today, I noticed something odd with timespans and formatting strings. I was trying to print a timespan, for instance 01:03:37 as 1:03:37 (without the leading 0 for hours). So I used the format string h:mm:ss. This, however, gave me a leading 0. If I converted the TimeSpan to a DateTime and did the same thing again, ...

Get the current date as the default argument for a method

I've got a method: def do_something(year=?, month=?): pass I want the year and month arguments to be optional but I want their default to equal the current year and month. I've thought about setting two variables just before the method declaration but the process this is part of can run for months. It needs to be dynamic. Seems l...

Ensuring index is used on Informix DATETIME column

Hi. Say I have a table on an Informix DB: create table password_audit ( username CHAR(20), old_password CHAR(20), new_password CHAR(20), update_date DATETIME YEAR TO FRACTION)); I need the update_date field to be in milliseconds (or seconds maybe - same question applies) because there will be multiple updates of the pa...

Calculating wage by hours worked

Hey all, i am trying to figure out how to calculate the wage for an employee when they clock out. This is the code i am currently using: Dim theStartTime As Date Dim theEndTime As Date Dim totalTime As String theStartTime = "16:11:06" theEndTime = "18:22:01" totalTime = Format(CDbl((theEndTime - theStartTime) * 24), "#0.0") So ...

DateTime Convert from int to Month Name in C#, Silverlight

In a nutshell, I am trying to print out the name of the month not the integer value of each month. (for example if the date is 2/2/2002, I would like the "month" to read out "February" instead of "2." I am pulling in the system.DateTime.now to get the current month. When I try to print out the current month on the form, it just puts th...

How to get an isoformat datetime string including the default timezone?

I need to produce a time string that matches the iso format yyyy-mm-ddThh:mm:ss.ssssss-ZO:NE. The now() and utcnow() class methods almost do what I want. >>> import datetime >>> #time adjusted for current timezone >>> datetime.datetime.now().isoformat() '2010-08-03T03:00:00.000000' >>> #unadjusted UTC time >>> datetime.datetime.utcnow(...

How to Remove Date From Posts

I have the date in all of my posts and I'd like to remove them, both from the main page and from individual post pages. My site is SweatingTheBigStuff.com. I think this is the code to look at. It's in the index.php file and there is something similar in the single.php file. <?php ob_start(); ?> <?php $icons = array(); ?> <?php if (!is_...

what date/time considerations when we create event based site?

hi, I would like to know how to handle date and time if we do any site where we ask users to create evetns like evite.com. my confusion is, if I create an event for Aug 5th and then invite 200 persons from different places(outside the event country), how evite sends the reminder because the time is different in some countries i.e. it wi...