1 |
maya |
3227 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
2 |
|
|
"http://www.w3.org/TR/html4/strict.dtd"> |
3 |
|
|
<html> |
4 |
|
|
<head> |
5 |
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
6 |
|
|
<title>getdate</title> |
7 |
|
|
<meta http-equiv="Content-Style-Type" content="text/css"> |
8 |
|
|
<link rel="stylesheet" href="../../style.css" type="text/css"> |
9 |
|
|
</head> |
10 |
|
|
|
11 |
|
|
<body> |
12 |
|
|
|
13 |
|
|
|
14 |
|
|
<h1>getdate</h1> |
15 |
|
|
|
16 |
|
|
<p> |
17 |
|
|
Gets current date. |
18 |
|
|
</p> |
19 |
|
|
|
20 |
|
|
<pre class="macro-syntax"> |
21 |
maya |
4923 |
getdate <strvar> [<format> [<timezone>]] |
22 |
maya |
3227 |
</pre> |
23 |
|
|
|
24 |
|
|
<h2>Remarks</h2> |
25 |
|
|
|
26 |
|
|
<p> |
27 |
|
|
Returns the current date in the string variable <strvar>, with the default format "YYYY-MM-DD". |
28 |
nmaya |
10870 |
The user can specify the format same as <a href="http://msdn2.microsoft.com/en-us/library/fe06s4ak(VS.80).aspx" target="_blank">strftime</a>. And also, the default format equals "%Y-%m-%d" at the <format> argument. |
29 |
maya |
3227 |
</p> |
30 |
|
|
|
31 |
|
|
<p> |
32 |
yutakapon |
4921 |
The behavior of the getdate command specified with the format equals the gettime command specified with the same format.<br> |
33 |
yutakapon |
4951 |
When the <timezone> argument is specified as a timezone string, the timestamp is generated by using the timezone. |
34 |
|
|
When the <timezone> argument is not specified, the timestamp is treated as the localtime. |
35 |
|
|
</p> |
36 |
maya |
3227 |
|
37 |
|
|
<p> |
38 |
|
|
This command returns one of the following values in the system variable "result": |
39 |
|
|
</p> |
40 |
|
|
|
41 |
|
|
<table> |
42 |
|
|
<thead> |
43 |
|
|
<tr> |
44 |
|
|
<th>Value</th> |
45 |
|
|
<th>Meaning</th> |
46 |
|
|
</tr> |
47 |
|
|
</thead> |
48 |
|
|
|
49 |
|
|
<tbody> |
50 |
|
|
<tr> |
51 |
|
|
<td>0</td> |
52 |
|
|
<td> |
53 |
|
|
Normal success. <strvar> is stored. |
54 |
|
|
</td> |
55 |
|
|
</tr> |
56 |
|
|
|
57 |
|
|
<tr> |
58 |
|
|
<td>1</td> |
59 |
|
|
<td> |
60 |
doda |
5266 |
Error. <strvar> is not stored because a length of the generated string exceeds the upper limit -511 characters-. |
61 |
maya |
3227 |
</td> |
62 |
|
|
</tr> |
63 |
|
|
|
64 |
|
|
<tr> |
65 |
|
|
<td>2</td> |
66 |
|
|
<td> |
67 |
|
|
Error. <format> is invalid. |
68 |
|
|
</td> |
69 |
|
|
</tr> |
70 |
|
|
</tbody> |
71 |
|
|
</table> |
72 |
|
|
|
73 |
|
|
<h2>Example</h2> |
74 |
|
|
|
75 |
|
|
<pre class="macro-example"> |
76 |
|
|
;Stores the current date to "datestr" variable with YYYY-MM-DD format. |
77 |
|
|
getdate datestr |
78 |
|
|
|
79 |
|
|
;Stores the current date with the user format to "logfile" variable. |
80 |
|
|
;The format is log-YYYYMMDD-HHMMSS.txt. |
81 |
|
|
getdate logfile "log-%Y%m%d-%H%M%S.txt" |
82 |
yutakapon |
4921 |
|
83 |
|
|
;To generate a GMT/UTC time stamp |
84 |
|
|
tz="GMT" |
85 |
|
|
gettime s "%Y/%m/%d %H:%M:%S" tz |
86 |
|
|
messagebox s tz |
87 |
yutakapon |
4972 |
|
88 |
|
|
;To retrieve Today's date. |
89 |
|
|
gettime s "|%d|%#d|" ; |07|7| (Today is 7th). |
90 |
|
|
gettime s "|%d|%#d|" ; |25|25| (Today is 25th). |
91 |
maya |
3227 |
</pre> |
92 |
|
|
|
93 |
|
|
<h2>See also</h2> |
94 |
|
|
<ul> |
95 |
|
|
<li><a href="gettime.html">gettime</a></li> |
96 |
nmaya |
10870 |
<li><a href="http://msdn2.microsoft.com/en-us/library/fe06s4ak(VS.80).aspx" target="_blank">strftime (MSDN Library)</a></li> |
97 |
maya |
3227 |
</ul> |
98 |
|
|
|
99 |
|
|
</body> |
100 |
|
|
</html> |