datetime

How do i determine the nth weekday of a given date in php

Hi, I am working on a calendar script where in i need to repeat a calendar event like "Repeat on every 1st Tuesday of every month" In the example above. How do you get the "1st"? for example today is June 12,2009 this would mean it's "2nd Friday of June" How do i get the "2nd"? Thanks in advance ...

DateTime.ParseExact - failing

Hi, Quick question: I'm trying to parse dates in the following format to their equivalent DateTime data type, but for some reason it's failing. The string format is: 28/May/2009:17:43:04 +0000 Or: dd/MMM/yyyy:hh:mm:ss zz00 Here's the code I'm using: Dim provider As New CultureInfo("en-US") Dim d As DateTime = DateTime.ParseExact(v...

how do I get the string representation of the users timezone using javascript?

I want to output the users system timezone, e.g. "EST". How can I do that, preferably using Javascript, though I could do it on the PHP side as well, if that's significantly easier. ...

Format .NET DateTime "Day" with no leading zero

For the following code, I would expect result to equal 2, because the MSDN states that 'd' "Represents the day of the month as a number from 1 through 31. A single-digit day is formatted without a leading zero.". DateTime myDate = new DateTime( 2009, 6, 4 ); string result = myDate.ToString( "d" ); However, result is actually equal to...

Mysql Datetime with Time zone

Hi All, I need a help in how to store datetime along with timezone. i am using Mysql 5.1. i want to do something like - create table tb1 ( c1 datetime with time zone ); ...

Does today's date intersect existing ranges in database PHP/MYSQL

I'm creating a time off requester for my business and I think I've run into a small issue. Goal: I want to display a page that will show me if anyone has request the current day off. Problem: I have the date_from and date_to fields which contain the information of the start and end dates for each request off. However, and I apologize...

Comparing dates in rails

Suppose I have a standard Post.first.created_at datetime. Can I compare that directly with a datetime in the format "2009-06-03 16:57:45.608000 -04:00" by doing something like: Post.first.created_at > Time.parse("2009-06-03 16:57:45.608000 -04:00") Edit: Both fields are datetimes, not dates. ...

Creating a range of dates in Python

Hello, I want to create a list of dates, starting with today, and going back an arbitrary number of days, say, in my example 100 days. Is there a better way to do it than this? import datetime a = datetime.datetime.today() numdays = 100 dateList = [] for x in range (0, numdays): dateList.append(a - datetime.timedelta(days = x)) p...

How can i catch '02/31/2010' as an invalid date using DateTime class?

I've been using the DateTime class in PHP because date() has the downsides of Unix Timestamp. However, neither approach detects invalid dates for months which don't have 31 days but attempt to use the 31st day. Example Code: try { $date = new DateTime('02/31/2018'); $formattedDate = $date->format('Y-m-d'); } catch (Exception $e) {} ech...

How to convert DateTime to a number with a precision greater than days in T-SQL?

Both queries below translates to the same number SELECT CONVERT(bigint,CONVERT(datetime,'2009-06-15 15:00:00')) SELECT CAST(CONVERT(datetime,'2009-06-15 23:01:00') as bigint) Result 39978 39978 The generated number will be different only if the days are different. There is any way to convert the DateTime to a more precise number, a...

T-SQL Time Averaging

I have a table in SQL Server that stores statistics for a piece of hardware, rows in the table represent data for a given second. It contains for example, these columns: timestamp (DateTime) value (int) What I want to do is select the data from the table for a given date/time range but return it in such a way that it averages for a gi...

SSRS 2008 Displaying Date Datetype correctly

I'm using SQL 2008 and SSRS 2008: CREATE TABLE [dbo].[DimDates]( [pkDateID] [int] NOT NULL, [FullDate] [date] NULL, [DayNumberOfWeek] [tinyint] NULL, [DayNameOfWeek] [varchar](9) NULL, [IsLastDayOfMonth] [char](1) NULL, [MonthName] [varchar](9) NULL, [CalendarDay] [smallint] NULL, [CalendarWeek] [tinyint]...

how to convert datetime to unix timestamp in c?

the scenario is: I get datetime in format "YYYY-MM-DD HH:MM:SS" with libexif. To minimize the saving cost, I wanna convert the datetime to unix timestamp or alike which only cost 64bit or 32bit. Is there any explicit way with c? ...

How should I filter dates in MySQL?

I'm creating a set of "archive" pages that are specified by year and month. In my table I have a datetime field called posted. I want to select all rows that are in a particular month. I've thought of two solutions: (1) Use string matching: SELECT ... WHERE posted LIKE '2009-06%' (2) Use some MySQL extraction functions: SELECT ... ...

Is there a natural language parser for date/times in javascript?

Is there a natural language parser for date/times in javascript? ...

Is there a natural language parser for dates/times in ColdFusion?

Is there a natural language parser for date/times in ColdFusion? ...

DateDiff for Months in Umbraco

I am trying to get the number of months between two dates in my xslt file like so: <xsl:variable name="now" select="umbraco.library:CurrentDate()"/> <xsl:value-of select="umbraco.library:DateDiff('2010-12-01', $now, 'm')" /> Unfortunately, this seems to give me the number of minutes between the two dates rather than the number of mont...

How to read .net xml serialized datetimes from java?

I am porting some of our app from c# to java. Some data objects get xml serialized and stored for later use. The built in .net xml serialization automatically saves DateTime properties in the format below: 2009-05-11T16:47:08.6033346-04:00 How can I get this into a Date object in Java? I read that the date format is ISO 8601 which ...

How to truncate milliseconds off of a .NET DateTime

I'm trying to compare a time stamp from an incoming request to a database stored value. SQL Server of course keeps some precision of milliseconds on the time, and when read into a .NET DateTime, it includes those milliseconds. The incoming request to the system, however, does not offer that precision, so I need to simply drop the millise...

How to add one day to a date?

I want to add one day to a particular date. How can I do that? Date dt = new Date(); Now I want to add one day to this date. ...