java - How do I seperate date and time from this below code can anybody help me -
string pickup = date format. date time instance( date format. short, date format. short).format( tree.pickup);
gives output 3/21/15 5:58 am
. i'm trying output date 3/21/15 , time 5:58 am
how can achieve this?
you can try code also, try use date time formats.
import java.text.dateformat; import java.text.simpledateformat; import java.util.calendar; public class j2 { public static void main(string[] args) { dateformat f1 = new simpledateformat("yyyy/mm/dd"); dateformat f2 = new simpledateformat("hh:m:s:a"); calendar cal = calendar.getinstance(); string date = f1.format(cal.gettime()); string time = f2.format(cal.gettime()); system.out.println(date); system.out.println(time); } }
Comments
Post a Comment