date

How to compare two dates in Objective-C

how to compare two date in objective c that is . i have two date.. 2009-05-11 and current-date i want check the given date is current-date or not... how it is possible... pls help me detailed .. thanks and regards .. by raju.. ...

Determine if a String is a valid date before parsing

I have this situation where I am reading about 130K records containing dates stored as String fields. Some records contain blanks (nulls), some contain strings like this: 'dd-MMM-yy' and some contain this 'dd/MM/yyyy'. I have written a method like this: public Date parsedate(String date){ if(date !== null){ try{ 1. cr...

Bash date/time arithmetic

I have a little Bash script which suspends the computer after a given number of minutes. However, I'd like to extend it to tell me what the time will be when it will be suspended, so I can get a rough idea of how long time I have left so to speak. #!/bin/sh let SECS=$1*60 echo "Sleeping for" $1 "minutes, which is" $SECS "seconds." slee...

Date processing in Java

Hi all I have 2 strings which are actually dates but they are in different format: 2004-06-01 00:00:00 (This value I get from Excel database through JDBC) 6/1/2004 Is their any pre-defined Class in Java which I can use to create Date kind of object? So that I can just invoke its constructor over these Strings and finally compare the...

How to determine client pc date format

Is there any way by which we can find Date Format as set in the computer where web pages are loading? I want to show date in my web pages according to what is set in client machine system. I have seem an ASP based web page which lists all the system setting of a clients system including information of drivers installed! So if it is po...

How to calculate a relative date based on a date string

I'd like to find the date after a date provided by the user This is not working: $start_date = '2009-06-10'; $next_day = date( $start_date, strtotime('+1 day') ); echo $next_day; // 2009-06-10 ...

Work out and set date

Ok, say a user buys a 6 month subscription to my online app. Using c# or vb.net, How would I work out what the expiry date should be to be inserted into the database. ...

How to check if a date is in a given range?

If you have a $start_date and $end_date, how can you check if a date given by the user falls within that range? e.g. $start_date = '2009-06-17'; $end_date = '2009-09-05'; $date_from_user = '2009-08-28'; At the moment the dates are strings, would it help to convert them to timestamp integers? ...

End of month calculations

Hi guys Just wondering if any know of an elegant solution for the following. If I have 30 June 2009 and I add a month I want it to go to 31 July 2009, not the 30 July 2009. This logic is based on the fact that the 30 June 2009 was the end of the month of June and when I add a month I want to go to the end of the next month. But if...

Find out Last 30 Days, 60 Days and 90 Days in java

Hi, How to get last 30 / 60 / 90 days records from given date in java? I have some records with receivedDate. I want to fetch the records for last 30 or 60 or 90 days from received Date. How to resolve it? Thanks in advance Gnaniyar Zubair ...

What's going on with Java's Date class? Is this a known bug?

I know Date is mostly deprecated, but I still use it form time to time (less code than using Calendar). I came across a truly bizarre bug, and I'm wondering if anyone can explain this to me. This code, which adds 24 days to the current time: long nowL = System.currentTimeMillis(); Date now = new Date(nowL); System.out.println("now = "+...

Using HQL to query on a date while ignoring the time on Oracle

I have a table (in Oracle 9 and up) where I need to find all entries for a given day using Hibernate. The entries have timestamps (with data type 'date'). Some of the entries have a time, others only have a date. This can not be changed, as this is the output of other applications which I can not change. In SQL I would write something al...

Formatting date times provided as strings in Django.

In my Django application I get times from a webservice, provided as a string, that I use in my templates: {{date.string}} This provides me with a date such as: 2009-06-11 17:02:09+0000 These are obviously a bit ugly, and I'd like to present them in a nice format to my users. Django has a great built in date formatter, which would do ...

Locale date formatting in Python

How do I get datetime.datetime.now() printed out in the native language? >>> session.deathDate.strftime("%a, %d %b %Y") 'Fri, 12 Jun 2009' I'd like to get the same result but in local language. ...

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 ...

How do I format a Javascript Date?

How do I format this date so that the alert displays the date in MM/dd/yyyy format? <script type="text/javascript"> var date = new Date(); alert(date); </script> ...

what is the best way to use dates with java swing

what i want to do is having like the java script popup date chooser in my application. i am using java swing and would like to avoid any input mistakes by the user. specifying a format is easy to implement but not user friendly for the user. what are your suggestion ? any libraries? ...

comparing dates in iPhone programming

How do you compare the current date with another date in iPhone programming.. eg: Date1= 1-10-2008 Date2=15-06-2009. i want know Date1 is a future date or a past date..? pls help me with code... thanks and regards.. raju ...

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...

Get current time and date

Hello, is there a crossplatform way to get current date and time in c++? Thanks. ...