This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to check if date/time was entered?  RSS feed

 
Kerry Shannon
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can you verify that a date / time was entered in a field? We tried to convert the time into a long, and then check if null, but it doesn't like that.
starttime = time.getDStartTime().getTime();
if (starttime == null)
{
starttime = 0;
}
What do you need to convert the time to before checking (String?), or what can you use to check a long?
 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use the DateFormat parse(String) method. It will throw an exception if the string is not a valid date.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!