date

Java equivalent of DateTime.MinValue, DateTime.Today

Is there a Java equivalent of DateTime.MinValue and DateTime.Today in the Java Date class? Or a way of achieving something similar? I've realised how spoilt you are with the .NET datetime class, I also need the equivalent of AddDays(), AddMonths(). ...

Trying to compute age in groovy

I have a date object that holds a persons birthday. My code looks like: def getAge(){ //birthday, birthYear, birthMonth, birthDayOfMonth are class level properties def c= new GregorianCalendar(birthYear, birthMonth-1, birthDayOfMonth) birthday = c.time //What do I do now? } I need to return the age of the person. How...

Collection for storing objects with date

I have some objects with Date parameters. What collection will be best for storing them and later querying for object/objects with particular date ? (like given as a String or java.util.Date format) ? EDIT: I was trying to use TofuBear's solution, but cannot make it work. let's say I am calling my function (which returns Map) with a ...

How to check validity of Date String ?

In my project I need to check if a date string evaluates to a proper Date object. I've decided to allow yyyy-MM-dd, and Date formats [(year, month, date) and (year, month, date, hrs, min)]. How can I check if they're valid ? My code returns null for "1980-01-01" and some strange dates (like 3837.05.01) whon giving a string separated by c...

Get name of day from month, year, and day.

Does anyone know a way to convert a month, year, and day into the day's name for any year? Example: function convert(day, year, month) ... return "Monday" end Thanks in advance! ...

How do you format the day of the month to say "11th", "21st" or "23rd" in Java?

I know this will give me the day of the month as a number (11, 21, 23): SimpleDateFormat formatDayOfMonth = new SimpleDateFormat("d"); But how do you format the day of the month to say 11th, 21st or 23rd in Java? ...

Storing group of objects with Dates in a Map

I have a group of Events that occurred at some Dates. Each event has a Date field. Now I'd like to create a Map where for each Date (taken from all dates of events) I will assign List of Events that occurred on that date. So in pseudocode : public Map<Date, List<Event>> function(List<Event> list){ Date[]dates = new Date(list.len())...

Parse ONLY a time string with DateJS

I'm using the excellent (but large) DateJS library to handle dates and times in my webapp. I just came across something that I'm not sure how to handle. I want my users to be able to enter Time strings only, without a date, but they should be able to enter it in any manner they please. For instance: 5:00 pm 17:00 5:00pm 5:00p 5p etc. ...

How to parse a Sharepoint Date from Hex to a java.util.Date

Hello, I'm trying to parse a Date from a MS Sharepoint into a java.util.Date. The Details: I query a Sharepoint from a Grails webapp via the SOAP GetListItems method. In the Sharepoint list, the date is displayed correctly, here 09/11/2009 but in the SOAP response, I get 0x01ca60cf|0x94894000 Further, this only happens with docx, pptx,...

parse this type of date format in java?

Hi, what would be the easiest way to parse this date format below in java?: 2010-09-18T10:00:00.000+01:00 i read the DateFormat api in java and could not find a method that takes a string or even this type of date format as a paremeter to parse? When i mean by parse i mean i want to extract the "date (day month and year)", "time" and ...

How to get current System date in SmartGwt application

Hi All, How to get current system date in Smartgwt application (Merely javascript). I need date to be printed as 25 October 2010 something like this. Currently i am using the following code: String currentDate ; java.util.Date date = new Date(); String tempDate = date.toString(); String[] currDate = tempDate.split(" "); currentD...

how to create a directory/folder in app with current date as a name

i want to create a folder in our app local directories ... the file structure i want to create will look like current date year/month/date the root directory of this structure is year inside that current month inside that current date folders .. this way i hav to create the folders... any help appreciated... ...

jquery, work with date

Hi, how in jQuery work date? I want to perform mathematical operations to date. var date = '2010-11-23 21:32:31'; var date = date - 70; alert(date); how get: 2010-11-23 21:31:21 Thanks ...

Is there a date/time format that does not have spaces?

I have a CGI script that will convert a given string to a date/time using the unix date command. I'm looking for a format that can easily be embedded to a URL without the need for escaping with a %20. The client that is building the date/time into the URL does not have a conversion to unix time (seconds since epoch) and does not have a...

Looping through weeks of the year in Ruby (Sinatra)

Hello. I'm creating a very simple timeshare application using Sinatra and Datamapper. Every user in the application will have n reservations and for the time being each reservation runs from Monday to Sunday and there can only be one reservation per week. Now I will need a view with a textbox (and label) for each week of the year where ...

Extract number from the date in pl sql

Does anyone know if it is possible to take the date from a random date in pl sql. example. SELECT SYSDATE FROM DUAL and here the output would be say : 26-10-2010 13:30:34 Now I want to have just the date as a number. In this case that would be 26. Or is there some sort of function like IsNum that can recognize it for me. So I ...

iPhone timeIntervalSinceDate

I'm trying to measure time between taps. I've gathered code from a couple other posts, but still no luck. I running into issues when I'm taking the difference between two time stamps and trying to make it readable in seconds. // Time elapsed NSTimeInterval duration = [[NSDate date] timeIntervalSinceDate:touchesBegan]; NSDateForma...

how to change the value of Date.today within a running ruby process

Hi, I know this is a bad idea, but I have lots of legacy code and I want to run through some historical batch jobs. I dont want to change the systems date because other stuff runs on the same system. Is there any way that I can change the value that Date.today will return for the life of a given process only. The idea here is to rewind a...

querying a sqlite db with date needs always a time value too like ("yyyy-MM-dd 00:00:00");

Hello, I use C# and sqlite. To get data for a certain datetime value I have to write this: com.Parameters.Add(new SQLiteParameter("@MyDate", day.ToString("yyyy-MM-dd 00:00:00"))); In my database all date entries have a time date + 00:00:00. How can I query my database with ONLY a date format not datetime format? ...

How would you represent date of birthday in your java model?

And wait, don't rush to answer "java.util.Date", consider the following scenario. Person object having 2 fields: "birthday" and "nextMeeting" both java.util.Date. Now birthday stored in database as date type column (no time) for eg. 01-10-1979, and nextMeeting as datetime type for ex. 01-10-2010 20:00:00. You pull it from db, "birthday...