Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - How to parse date string to Date? -


this question has answer here:

how parse date string below date object?

string target = "thu sep 28 20:29:30 jst 2000"; dateformat df = new simpledateformat("e mm dd kk:mm:ss z yyyy"); date result =  df.parse(target);   

throws exception...

java.text.parseexception: unparseable date: "thu sep 28 20:29:30 jst 2000"         @ java.text.dateformat.parse(dateformat.java:337) 

the pattern wrong. have 3-letter day abbreviation, must eee. have 3-letter month abbreviation, must mmm. day , month abbreviations locale sensitive, you'd explicitly specify simpledateformat locale english well, otherwise use platform default locale may not english per se.

public static void main(string[] args) throws exception {     string target = "thu sep 28 20:29:30 jst 2000";     dateformat df = new simpledateformat("eee mmm dd kk:mm:ss z yyyy", locale.english);     date result =  df.parse(target);       system.out.println(result); } 

this prints here

thu sep 28 07:29:30 bot 2000

which correct per timezone.

i reconsider if wouldn't rather use hh instead of kk. read javadoc details valid patterns.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -