Remember something small. Gets the method for the current date/time in the format. C # 's ToString () Sure enough, I think the most loving way to format. Scripting languages, however, generally offer very handy methods, such as PHP, Perl, and Ruby, and so on, and JavaScript does not provide the format method, but writes itself a waste of nothing.
We all know C + + provides __date__ and __time__ macros, but these two macros are recorded at compile-time date and time, and can not be customized format, the discussion here is completely irrelevant ...
============================================================
DOS Batch File (on Windows NT):
Rely primarily on the command line's date/t and time/t commands to obtain the current system date and time, respectively.
Example:
2008-01-05 Saturday
11:20
Http://www.robvanderwoude.com/datetiment.html
============================================================
Java:
Java code
Import java.util.Date;
Import Java.util.Locale;
Import Java.text.DateFormat;
public class Greet {public
static void Main (string[] args) {
dateformat df
= dateformat.getdatetimeinstance (
dateformat.full, Dateformat.short, Locale.china);
String message = Df.format (new Date ());
SYSTEM.OUT.PRINTLN (message);
}
Friday, January 4, 2008 07:54
Several related classes in Java are Java.util.date,java.util.time,java.util.calendar, Java.text.dateformat,java.text.simpledateformat and so on.
I'm not using a custom format in the example here, directly using the format specified by the Dateformat.full in the standard format.