date

deserializing date in jackson

I have a date in a json string (returned from an ASP.NET rest service) that looks like this: "created": "/Date(1277931782420-0700)/" Jackson is not able to parse this date. I can write my own date format and pass it in to mapper.getDeserializationConfig().setDateFormat(); but i was wondering if there is an easier/better way to do this....

sql scalar function returns invalid quarter

I am sure that I am overlooking some simple thing, I admit that I am still learning various aspects of SQL and the Datepart function is one.. I am inputting a date and returning an invalid quarter, here is the code: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER FUNCTION Dbo.FN_Get_Quarter ( -- the parameters for the functi...

Count occourances by hour in PHP

I have a script that polls a MySQL database (Nagios, specifically) for the date/time of events. I want to count how many events occur in each hour based upon all of the data my script returns. Here is what the results look like: (each on their own line) 2010-03-01 03:20:26 2010-02-28 19:07:26 2010-02-28 00:50:37 2010-02-27 17:07:35 ...

Writing correct Date on Oracle with C# and Net 4

Hi all, i'm stucked on a Date Column that stored a wrong Date. i'm using VS 2010 with .NET 4 and oracle 11g (Oracle.dataAccess.dll version 2.112.0.1) and i have to fill a column with a full date (dd:mm:yyyy hh24:mi:ss) I use a complex query with a lot of parameters in that way: cmd.Parameters.add(":date", OracleDBType.Date, myDate, Pa...

Extending Date class in ruby

Hi All, I want to extend Date class in ruby.Actually what I want to do is that add a method to Date class. Following is an example I want to add 'my_simple_method' method to Date class def my_simple_method puts 'this is from my_simple_method' end after adding this users should be able to call this method as date_obj = Date.parse...

C# - Parsing partial dates in different formats

Hi there. For use in a search method i would like to parse partial dates in different formats. I want to enable the user to search for day and month or month and year or also day and month and year. But the more problematic thing is that i want do this in all possible date formats depending on the country, the user is in. It's a ASP.NET...

BASH script to copy files based on date, with a catch...

Let me explain the tree structure: I have a network directory where several times a day new .txt files are copied by our database. Those files sit on directory based on usernames. On the local disk I have the same structure (directory based on usernames) and need to be updated with the latest .txt files. It's not a sync procedure: I copy...

How can I capture date information from a rails form?

Hi all, I followed a few rails tutorials online, and it seems that to capture a date, I'd use date_select helper. But for some reason or another all the other data is captured in the database (SQLite3) except for the birthday. Any idea what I'm doing wrong? Here's the code for the form in my view: <% form_for :user, :url => {:contr...

PHP: How to get age in php from day, month, year ?

I have 3 variables $day, $month, $year each of them have the values what the users given to them. I want to get his real Age too from these 3 variables. For example the user enters this date for his birthdate in this format day,month,year: 04, 07, 1990 -> Now his age is 19 02, 07, 1990 -> Now his age is 20 I want to have i...

Calculate total seconds in PHP DateInterval

What is the best way to calculate the total number of seconds between two dates? So far, I've tried something along the lines of: $delta = $date->diff(new DateTime('now')); $seconds = $delta->days * 60 * 60 * 24; However, the days property of the DateInterval object seems to be broken in the current PHP5.3 build (at least on Windo...

Page or Form First Control Focus Issue for dijit.Form.DateTextBox

I would like to inquire about the issue of dijit DateTextBox, When a DateTextBox is the first control in the page, the popup control is no longer shown since the toolkit probably waits for onfocus event to show the popup instead of the onclick. Is there anyway to make the first date textbox control to show the popup when the mouse is pl...

SQL Search with parameter that could be date or could be string

Hi there. I have a search box where you can enter plain text. The keywords are separated by spaces. I check each keyword if it fits the format for a date and store 'all keywords' in one array and 'date keywords' in another. All the 'date keywords' are also in the 'all keywords' array, as I can not tell if its 'only' a date or maybe also ...

Best way to convert Java SQL Date from yyyy-MM-dd to dd MMMM yyyy format.

Hello Is there a straightforward way of converting a Java SQL Date from format yyyy-MM-dd to dd MMMM yyyy format? I could convert the date to a string and then manipulate it but I'd rather leave it as a Java SQL Date. at the time I need to do this, the data has already been read from the MySQL database so I cant do the change there. T...

One type of delimiter in one date time string in RegEx

Hi all, Is there any way to write a Regex that can validate one type of delimiter in one date time string only? For example, 30/04/2010 is correct but 30-04/2010 is incorrect. I googled and found something about backtrack but I am not very sure how to use it. For example, if i have this regex: (?P<date>((31(?![\.\-\/\—\ \,\–\-]{1...

PHP date problem

Hi, I have web service in PHP which gets dateTime object (from asp) . I want to parse this date in my custom format . The date originally is in format "2010-07-05T00:00:00+02:00" . When I'm trying this: $oDate = strtotime($date_from_webservice); $sDate = date("d.m.Y",$oDate); echo $sDate; I'm getting date "07.04.2010" which is one da...

if php date is 24 hours after stored mysql date...

Hi all, I'm trying to do a function that will check the php date against what is in the database. If the current date (YYYY-MM-DD HH:MM:SS) is 24 hours after the stored database date, then it will continue, otherwise it won't do anything.. If that makes sense? Here's how I'm trying to get it to work, but not 100% sure how: $now = date...

Given a Year and a Week number, how can I get the first date in that week, in .Net?

Possible Duplicate: Calculate date from week number I have a Year and a Week number within that year (I got these by doing "YEAR(Date) AS Year, DATEPART(WEEK, Date) AS Week" in SQL), and I'd like to know the date of the first day of that week. Actually, ANY day in that week is good enough, I just think the first one is the mo...

SimpleDateFormatter won't parse!

Hello I am trying to use the SimpleDateFormatter to parse the date Wed, 30 Jun 2010 15:07:06 CST I am using the following code public static SimpleDateFormat postedformat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss z"); Date newDate = new Date(posteformat.parse("Wed, 30 Jun 2010 15:07:06 CST")); but I am getting an illeg...

Java Date Format Conversion

I am currently pulling three form field inputs off the request object. The day, the month, and the year. Day would be 11 for 11th day of the month Month would be 12 for december Year would be 2010 representing this year. I need to convert this into a Java Date object, but since so much has been changed, I am not sure what the best w...

TSQL need to return last day of month only, how do I drop year, month & time?

I am writing a User defined function in TSQL trying to get the last day of the month regardless of the date input. I am struggling with this as I am a newbie. Any help will be very much appreciated. Here is my function: Alter Function dbo.FN_Get_Last_Day_in_Month2 (@FN_InputDt Datetime) Returns smalldatetime as Begin Declare @Resu...