艳情短篇合集全文目录篇txt m.01bz.top m.jxtxt.com m.01bz.top m.j

Display or change the date.
date [option]... [+Format]
date [option] [MMDDhhmm[[CC]YY][.ss]]
'date' with no arguments prints the current time and date, in the
format of the %c directive (described below).
If given an argument that starts with a +, date prints the
current time and date (or the time and date specified by the --date option, see below) in the format defined by that argument, which is the
same as in the strftime function.
Except for directives, which start
with %, characters in the format string are printed unchanged.
directives are described below.
-d, --date=String
Display time described by String, instead of 'now'
this can be in almost any common format.
It can contain month names, timezones, 'am' and 'pm',
'yesterday', 'ago', 'next', etc.
-f, --file=DateFile
like --date once for each line of DateFile
If DateFile is '-', use standard input.
useful when you have many dates to process,
because the system overhead of starting up the
'date' executable many times can be considerable.
-I, --iso-8601[=Timespec] Output an
compliant date/time string., '%Y-%m-%d'.
Timespec='date' (or missing) for date only,
'hours', 'minutes', or 'seconds' for date and
time to the indicated precision.
If showing any time terms, then include the time zone
using the format '%z'.
If '--utc' is also specified,
use '%Z' in place of '%z'.
-r, --reference=File
Display the last modification time of File
-R, --rfc-822
Output RFC-822 compliant date string
Example: Mon, 19 Nov :56 -0600
-s, --set=String
Set time described by String (see -d above)
-u, --utc, --universal
Print or set Coordinated Universal Time
Display this help and exit
output version information and exit
Format controls the output as follows.
The only valid option for the second form (MMDDhhmm[[CC]YY][.ss])will specify Coordinated Universal Time.
Interpreted sequences are:
Date in mm/dd/yy format (06/24/13)
Date in standard format for locale (09/24/13 for English-US)
Century (20 for 2015)
Year in 4-digit format (2015)
Year in 2-digit format (14)
Same as 'Y'
Same as 'y'
Month name - abbreviated (Jan)
Month name - full (January)
Same as 'b'
Month number (09)
Week of the year (00-52)
Week of the year (01-53)
If the week containing January 1 has four or
more days in the new year, then it is considered week 1;
otherwise, it is week 53 of the previous year, and the next week
is week 1. Similar to
(but not 100% compliant.)
Same as 'W'
Day of the week - abbreviated name (Mon)
Day of the week - full name (Monday)
Day of the week - number (Monday = 1)
Day of the month - 2 digits (05)
Day of the month - digit preceded by a space ( 5)
Day of the year - (1-366)
Same as 'u'
Time in 12-hour format (09:15:36 AM)
Time in 24-hour format - no seconds (17:45)
Time in 24 hour format (17:45:52)
Same as 'T'
Time offset from UTC (-07) This generally consists of Time Zone+DST
Hour in 24-hour format (17)
Hour in 12 hour format (05)
Same as 'H'
Same as 'I' (Upper-case I = Lower-case L)
Minutes & Seconds:
Minutes (35)
Seconds (05)
Seconds elapsed since January 1, :00 GMT ()
Here are the same format codes in alphabetical order:
a literal %
locale's abbreviated weekday name (Sun..Sat)
locale's full weekday name, variable length (Sunday..Saturday)
locale's abbreviated month name (Jan..Dec)
locale's full month name, variable length (January..December)
locale's date and time (Sat Nov 04 12:02:33 EST 1989)
day of month (01..31)
date (mm/dd/yy)
day of month, blank padded ( 1..31)
same as %b, locale's abbreviated month name (Jan..Dec)
hour :24 hour(00..23)
hour :12 hour(01..12)
day of year (001..366)
hour :24 hour(00..23)
hour :12 hour(01..12)
month (01..12)
minute (00..59)
locale's AM or PM
Time, 12-hour (hh:mm:ss [AP]M)
Seconds since
(a GNU extension)
Note that this value is defined by the localtime system
It isn't changed by the '--date' option.
second (00..60)
a horizontal tab
Time, 24-hour (hh:mm:ss)
Week number of year with Sunday as first day of week (00..53)
Week number of year with Monday as first day of week (01..53)
If the week containing January 1 has four or
more days in the new year, then it is considered week 1;
otherwise, it is week 53 of the previous year, and the next week
is week 1. Similar to
(but not 100% compliant.)
day of week (0..6);
0 represents Sunday
week number of year with Monday as first day of week (00..53)
locale's date representation (mm/dd/yy)
locale's time representation (%H:%M:%S)
last two digits of year (00..99)
year (1970...)
RFC-822 style numeric timezone (-0500) (a nonstandard extension)
This value reflects the current time zone.
Is not changed
by the --date option.
Time offset from UTC (-07) This generally consists of Time Zone+DST
Is not changed by the --date option.
By default, date pads numeric fields with zeroes.
GNU date recognizes the following modifiers between % and a numeric directive.
- (hyphen)
useful if the output is intended for human consumption.
_ (underscore) pad t useful if you need a fixed number of characters in the output, but zeroes are too distracting.
The - and _ are GNU extensions. Here is an example illustrating the differences:
date +%d/%m -d "Feb 1"
date +%-d/%-m -d "Feb 1"
date +%_d/%_m -d "Feb 1"
Setting the time
If given an argument that does not start with +, date sets the
system clock to the time and date specified by that argument (as
described below).
You must have appropriate privileges to set the
system clock.
The --date and --set options can not be used with such an argument.
The --universal option can be used with such an
argument to indicate that the specified time and date are relative to Coordinated Universal Time rather than to the local time zone.
The argument must consist entirely of digits, which have the following meaning:
day within month
first two digits of year (optional)
last two digits of year (optional)
second (optional)
The '--set' option also s see the examples below.
Print the date of the day before yesterday:
$ date --date='2 days ago'
Rename a file with the current date and time
$ STAMPME=$HOME/demo_file_$(date +%Y%m%d-%H%M).txt
$ mv $HOME/demo_file $STAMPME
Print the date of the day three months and one day hence:
$ date --date='3 months 1 day'
Print the day of year of Christmas in the current year:
$ date --date='25 Dec' +%j
Print the current full month name and the day of the month:
$ date '+%B %d'
Note that the '%d' expands to a zero-padded two-digit field,
for example:
$ date -d 1may '+%B %d' &will print 'May 01'.
Print a date without the leading zero for one-digit days of the
month, you can use the (GNU extension) '-' modifier to suppress
the padding altogether.
$ date -d=1may '+%B %-d'
Print the current date and time in the format required by many
non-GNU versions of 'date' when setting the system clock:
$ date +%m%d%H%M%Y.%S
Set the system date and time
$ date --set=& 11:59 AM&
Set the system clock forward by two minutes:
$ date --set='+2 minutes'
Print the date in the format specified by RFC-822 (day month year hh:mm:ss zzz), use
To convert a date string to the number of seconds since the epoch
00:00:00 GMT (), use the '--date' option with the '%s' format.
That can be useful in sorting and/or graphing /or comparing data by date.
The following command outputs the number of the seconds since the epoch for the time one second later than the epoch, but in time zone five hours later (Cambridge,Massachusetts), thus a total of five hours and one second after
the epoch:
$ date --date=' 00:00:01 UTC +5 hours' +%s
Suppose you had not specified time zone information in the example above.
Then, date would have used your computer's idea of
the time zone (and DST) when interpreting the string.
Here's what you would get if you were in Greenwich, England:
# local time zone used
$ date --date=' 00:00:01' +%s
Seconds since the 1970 epoch can be useful when sorting or graphing dated data . But to convert a number of seconds back to a more
readable date, use a command like:
$ date -d '
sec' +"%Y-%m-%d %T %z"
00:00:00 +0000
&Carpe Diem - Seize the day& ~ Horace
- Display a calendar
- Schedule a command to run at a later time
- Measure Program Resource Use
- User and system times
- Change file timestamps
- YYYY-MM-DD
- online converter
Equivalent Windows command:
- Display or set the date +
- Display or set the system time.正在请求数据请稍候。。。
工具导航地图
网站信息查询:-
搜索优化查询:
域名IP类查询:
加密解密相关:
编码转换相关:-
HTML相关类: -
Js/Css相关类: -
其他常用测试:-
其他类别查询:-
合作查询网站:-shows how to bind a ListView to an array of string objects, but you'll probably outgrow that pretty quickly. This post will show you how to bind the ListView to an ArrayList of custom objects, as well as create a multi-line ListView.
Let's say you have some sort of search functionality that returns a list of people, along with addresses and phone numbers. We're going to display that data in three formatted lines for each result, and make it clickable.
First, create your new Android project, and create two layout files. Main.xml will probably already be created by default, so paste this in:
&?xml version="1.0" encoding="utf-8"?&
&LinearLayout xmlns:android=""
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"&
android:layout_height="wrap_content"
android:text="Custom ListView Contents"
android:gravity="center_vertical|center_horizontal"
android:layout_width="fill_parent" /&
android:id="@+id/ListView01"
android:layout_height="wrap_content"
android:layout_width="fill_parent"/&
&/LinearLayout&
Next, create a layout file called custom_row_view.xml. This layout will be the template for each individual row in the ListView. You can use pretty much any type of layout - Relative, Table, etc., but for this we'll just use Linear:
&?xml version="1.0" encoding="utf-8"?&
&LinearLayout xmlns:android=""
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"&
&TextView android:id="@+id/name"
android:textSize="14sp"
android:textStyle="bold"
android:textColor="#FFFF00"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/&
&TextView android:id="@+id/cityState"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/&
&TextView android:id="@+id/phone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/&
&/LinearLayout&
Now, add an object called SearchResults. Paste this code in:
public class SearchResults {
private String name = "";
private String cityState = "";
private String phone = "";
public void setName(String name) {
this.name =
public String getName() {
public void setCityState(String cityState) {
this.cityState = cityS
public String getCityState() {
return cityS
public void setPhone(String phone) {
this.phone =
public String getPhone() {
This is the class that we'll be filling with our data, and loading into an ArrayList.
Next, you'll need a custom adapter. This one just extends the BaseAdapter, but you could extend the ArrayAdapter if you prefer.
public class MyCustomBaseAdapter extends BaseAdapter {
private static ArrayList&SearchResults& searchArrayL
private LayoutInflater mI
public MyCustomBaseAdapter(Context context, ArrayList&SearchResults& results) {
searchArrayList =
mInflater = LayoutInflater.from(context);
public int getCount() {
return searchArrayList.size();
public Object getItem(int position) {
return searchArrayList.get(position);
public long getItemId(int position) {
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = mInflater.inflate(R.layout.custom_row_view, null);
holder = new ViewHolder();
holder.txtName = (TextView) convertView.findViewById(R.id.name);
holder.txtCityState = (TextView) convertView.findViewById(R.id.cityState);
holder.txtPhone = (TextView) convertView.findViewById(R.id.phone);
convertView.setTag(holder);
holder = (ViewHolder) convertView.getTag();
holder.txtName.setText(searchArrayList.get(position).getName());
holder.txtCityState.setText(searchArrayList.get(position).getCityState());
holder.txtPhone.setText(searchArrayList.get(position).getPhone());
return convertV
static class ViewHolder {
TextView txtN
TextView txtCityS
TextView txtP
(This is basically the same as the )
Finally, we'll wire it all up in the main class file:
public class CustomListView extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayList&SearchResults& searchResults = GetSearchResults();
final ListView lv1 = (ListView) findViewById(R.id.ListView01);
lv1.setAdapter(new MyCustomBaseAdapter(this, searchResults));
lv1.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView&?& a, View v, int position, long id) {
Object o = lv1.getItemAtPosition(position);
SearchResults fullObject = (SearchResults)o;
Toast.makeText(ListViewBlogPost.this, "You have chosen: " + " " + fullObject.getName(), Toast.LENGTH_LONG).show();
private ArrayList&SearchResults& GetSearchResults(){
ArrayList&SearchResults& results = new ArrayList&SearchResults&();
SearchResults sr1 = new SearchResults();
sr1.setName("John Smith");
sr1.setCityState("Dallas, TX");
sr1.setPhone("214-555-1234");
results.add(sr1);
sr1 = new SearchResults();
sr1.setName("Jane Doe");
sr1.setCityState("Atlanta, GA");
sr1.setPhone("469-555-2587");
results.add(sr1);
sr1 = new SearchResults();
sr1.setName("Steve Young");
sr1.setCityState("Miami, FL");
sr1.setPhone("305-555-7895");
results.add(sr1);
sr1 = new SearchResults();
sr1.setName("Fred Jones");
sr1.setCityState("Las Vegas, NV");
sr1.setPhone("612-555-8214");
results.add(sr1);
Notice that we first get an ArrayList of SearchResults objects (normally this would be from an external data source...), pass it to the custom adapter, then set up a click listener. The listener gets the item that was clicked, converts it back to a SearchResults object, and does whatever it needs to do.
Fire it up in the emulator, and you should wind up with something like this:
Update (2/22/2012): I've uploaded a complete Eclipse project of this tutorial to Dropbox:
Technorati Tags:
Email: (never displayed)
&(will show your )
Comment: Allowed tags: blockquote, a, strong, em, p, u, strike, super, sub, code
Verification:}

我要回帖

更多关于 艳情短篇合集全文阅读 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信