datetime

How to get the last day of a month?

If i have this date 03/08/1980 and I need to find the last day of the month (08) (the last day of 08 - is 31) How can I do it ? (in C#) ...

Why is PHP date() adding +1 hour in diff calculation?

Hi there, I've got kind of a tricky question, I already searched every related question on Stackoverflow and neither solved my conundrum, although I think I'm running in circles, so here's the question: I've got this code: $val = (strtotime('2010-03-22 10:05:00')-strtotime('2010-03-22 09:00:00')) This returns correctly $val = 3900 ...

How to get previous day using datetime.

I want to set a DateTime property to previous day at 00:00:00. I don't know why DateTime.AddDays(-1) isn't working. Or why DateTime.AddTicks(-1) isn't working. First should this work? I have 2 objects. Each object have DateTime fields ValidFrom, ValidTo. EDIT: After coming home from work I tried to get the same behavior as my business...

Finding begin and end of year/month/day/hour

I'm using the following snipped to find the begin and end of several time periods in Joda. The little devil on my left shoulder says thats the way to go... but I dont believe him. Could anybody with some joda experience take a brief look and tell me that the little guy is right? (It will be only used for UTC datetime objects) Thank ...

Java - Converting a datetime into gregorian calender time(date)

I am using google data api which gives date in datetime format. I want to convert this DateTime format date in Gregorian calendar date format. Does anyone know any methods for doing this? *Edited the question ...

Flex : converting seconds to readable english

For example : input = 360 seconds output = 6 minutes input = 86400 output = 1 day Is there a built-in method for this. I did find something similar here. Just want to know if there is a built-in method? ...

How to round-off hours based on Minutes(hours+0 if min<30, hours+1 otherwise) ?

I need to round-off the hours based on the minutes in a DateTime variable. The condition is: if minutes are less than 30, then minutes must be set to zero and no changes to hours, else if minutes >=30, then hours must be set to hours+1 and minutes are again set to zero. Seconds are ignored. example: 11/08/2008 04:30:49 should become 11/...

Quickest way to find the oldest file in a directory using Delphi

HI We have a large number of remote computers that capture video onto disk drives. Each camera has it's own unique directory and there can be up to 16 directories on any one disk. I'm trying to locate the oldest video file on the disk but using FindFirst/FindNext to compare the File Creation DateTime takes forever. Does anybody know...

Determining whether a month contains entries

I have a list of timestamped logs and I'd like a query to return 12 booleans say whether a certain month contains any logs, for each month of the year (starting from January), i.e.: (True, False, False, True, False ..., True) I currently have the following query, which will show me all months containing data: SELECT DISTINCT(EXTRACT(...

xsd:datetime and XmlGregorianCalendar causes NullPointerException

The following works: public Date getDate() { return date; } and produces something like: <date>2010-03-23T17:43:50.879Z</date> And I can use an XmlGregorianCalendar to return xsd:date or xsd:time types fine: @XmlSchemaType(name="date") public XmlGregorianCalendar getDate() { return date; } which produces something like: ...

Is there a way to formerly define a time interval for configuring a process?

Horribly worded question...I know. I'm working on an application that processes data for the previous day. The problem is that I know the customer is going to eventually ask to it for every hour or some other arbitrary time interval. I know that languages such as Java or SQL have masks for defining dates. Well what about a way to def...

Common way to compare timestamp in oracle, postgres and SQL Server

I am writing a sql query which involves finding if timestamp falls in particular range of days. I have written that in the postgres but it doesn't works in Oracle and SQL Server: AND creation_date < (CURRENT_TIMESTAMP - interval '5 days') AND creation_date >= (CURRENT_TIMESTAMP - interval '15 days') Is there are common way to compar...

Timezone conversion in php

can anyone suggest an easy method to convert date and time to different timezones in php ...

Oracle SQL: Query results from previous X isoweeks () (where X might be > 52)

How could I adapt this query to show the previous, say, 61 weeks? select to_char(order_date,'IYYY') as iso_year, to_char(order_date,'IW') as iso_week, sum(sale_amount) from orders where to_char(order_date,'IW') <> to_char(SYSDATE) --exclude this week in progress and to_char(order_date,'IYYY') = 2010 group...

mysql: check if interval between two dates is less than 1 second

Ok, I need something like this: datediff(second, date_one, date_two) < 1 dates are stored in a column 'datetime' type UPDATE I want to find dates which differ in less than several (say, 10) seconds ...

Is DateTime.ParseExact() faster than DateTime.Parse()

I would like to know if ParseExact is faster than Parse. I think that it should be ParseExact since you already gave the format but I also think all the checking for the Culture info would slow it down. Does microsoft say in any document on performance difference between the two. The format to be used is a generic 'yyyy/MM/dd' format . ...

Get the timestamp of exactly one week ago in PHP?

I need to calculate the timestamp of exactly 7 days ago using PHP, so if it's currently March 25th at 7:30pm, it would return the timestamp for March 18th at 7:30pm. Should I just subtract 604800 seconds from the current timestamp, or is there a better method? ...

PHP strtotime( YYYY-mm last day) a month off error

I'm trying the following command in PHP 5.2.12 : print (date('Y-m-d', strtotime('2009-12 last day'))); Regarding to the php.net manual : date('m/d/y', strtotime('2009-03 last day')); # 03/31/09 it should display the last day of march 2009 (2009-03-31) ! Mine returns the last day of the previous month ? why ? : 2009-11-30 ...

Should searchable date fields in a database table always be indexed?

If I have a field in a table of some date type and I know that I will always be searching it using comparisons like between, > or < and never = could there be a good reason not to add an index for it? ...

store Current Date & time in MySql Using ASP.net

I want to store the current date & time which can be get by System.DateTime.Now in asp.net but while storing in Mysql it gives Error of Invalid Time. ...