Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Compare two date and time objects

Compare two date and time objects

Put your problem here if it does not fit any of the other categories.

Compare two date and time objects

Postby erbedo » Fri Mar 14, 2008 10:41 pm

Hi
I got from an XML file a list of string in this format:
yyyyMMddhhmmss
I need to compare this values to the current time.
I tried to do:

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.                                
  2.  
  3.                                 DateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
  4.  
  5.                                 Date date = new Date();
  6.  
  7.                                 String timeNow = dateFormat.format(date);
  8.  
  9.                                
  10.  
  11.                                 // start is a long variable, containing a number in the format above
  12.  
  13.                                 if ( start >= timeNow ) {
  14.  
  15.                                      // doSomething()
  16.  
  17.                                 }
  18.  
  19.                         }
  20.  
  21.  
Parsed in 0.010 seconds, using GeSHi 1.0.8.4


But i got NullPointerException :(

Any hint?
erbedo
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Mar 13, 2008 9:39 pm

Top

Postby erbedo » Mon Mar 17, 2008 1:32 am

Update:

I found that such a number, like the above, is too big for a long variable. Actually, I've solved splitting the string in two part, date and time, and comparing each other to the current date and time, but... I hope there's another, appropriate method, but I wasn't able to find it out. Anybody knows it?

TIA
Proudly supporting Android :)
erbedo
Junior Developer
Junior Developer
 
Posts: 22
Joined: Thu Mar 13, 2008 9:39 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 11 guests