Android/java stock trading status based on current time (closed in open trades)

Source: Internet
Author: User
Tags date1

1  /**2       * @paramdata yyyy-mm-dd HH:mm:ss time3       * @returnclosed in open trades4       */5      Public Staticstring Getsotckstatus (String data) {6String s = "";7         Try {8SimpleDateFormat SDF =NewSimpleDateFormat ("Yyyy-mm-dd HH:mm:ss");9Date date1 =sdf.parse (data);TenCalendar cal =calendar.getinstance (); One Cal.settime (date1); A             //Calendar cal = Calendar.getinstance (); -             inthour =Cal.get (calendar.hour_of_day); -             intminutes =Cal.get (calendar.minute); the             if(Hour >= 0 && Hour < 10) { -                 if(Hour >= 9) { -                     if(Minutes >= 30)//9:30-10:00 -s = "in Trading"; +                     Else -                         //9:00-9:30 +s = "Not open"; A}Else{//0:00-9:00 ats = "Not open"; -                 } -}Else if(Hour > 9 && Hour < 12) { -                 if(Hour > 10) { -                     if(Hour >= 11) { -                         if(Minutes >= 30)//11:30-12:00 ins = "in Rest"; -                         Else to                             //11:00-11:30 +s = "in Trading"; -}Else{//10:00-11:00 thes = "in Trading"; *                     } $}Else {Panax Notoginseng                     if(Minutes >= 30)//9:30-10:00 -s = "in Trading"; the                     Else +                         //9:00-9:30 As = "Not open"; the                 } +}Else if(Hour >= && Hour < 13) { -                 if(Hour < 12) { $                     if(Minutes >= 30)//11:30-12:00 $s = "in Rest"; -                     Else -                         //11:00-11:30 thes = "in Trading"; -}Else {Wuyis = "in Rest"; the                 } -}Else if(Hour > && Hour < 15) { Wu                 if(Hour >= 13) {//13:00-15:00 -s = "in Trading"; About}Else{//12:00-13:00 $s = "in Rest"; -                 } -}Else if(Hour >= && hour <= 24) {//15:00-24:00 -s = "Closed"; A             } +}Catch(Exception e) { the e.printstacktrace (); -             returns; $         } the         returns; the}

Android/java stock trading status based on current time (closed in open trades)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.