Date - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Date

Description:

Title: Date & Time Author: ICT Last modified by: Administrator Created Date: 12/26/2005 11:59:20 AM Document presentation format ... – PowerPoint PPT presentation

Number of Views:73
Avg rating:3.0/5.0
Slides: 20
Provided by: ICT70
Category:

less

Transcript and Presenter's Notes

Title: Date


1
Date Time
  • ????????? ??????????
  • ???????????????????????????????????????
  • ????????????????? ?????

2
???????
  • ????????????????????????????????????
  • ???????????????????? (Calendar)

3
????????????????????????????????????
  • ?????????????? date()
  • ?????????????? getdate()
  • ????????????????????????????????????????

4
?????????????? date()
date(string format)
??????
  • ???????????????????????????????????
    ??????????????????????????????????????????????????
    ??????????????

format ???????????????????????????????????
5
FORMAT
Code ????????
a ???????????? ???????? ???????????????? "am" ???? "pm"
A ???????????? ???????? ???????????????? "AM" ???? "PM"
B ?????????????????????? http//www.swatch.com/internettime/home.php
d ????????????????? 2 ???? ??? 01 ??? 31
D ????????????????? 3 ???? ??? Mon ??? Sun
F ???????????????????? ??? January ??? December
6
FORMAT
Code ????????
g ??????????? ???????? 12 ??. ??? 1 ??? 12
G ??????????? ???????? 24 ??. ??? 0 ??? 23
h ??????????? ???????? 12 ??. ??? 01 ??? 12
H ??????????? ???????? 24 ??. ??? 00 ??? 23
i ???????? ???????? 00 ??? 59
I ????????????? Daylight saving ???????????????? 1 ???????????????? Daylight saving ???????????????? 0
7
FORMAT
Code ????????
j ?????????? ??? 1 ??? 31
l ?????????????????? ??? Monday ??? Sunday
L ?????????? 1 ????????????????????? ??? 0 ???????????????????????
m ??????????????????? 2 ???? ??? 01 ??? 12
M ???????????????????????????? 3 ???????? ??? Jan ??? Dec
n ??????????????????? ??? 1 ??? 12
s ???????????????????? 2 ???? ??? 00 ??? 59
8
FORMAT
Code ????????
S ?????????????????? ???? st, nd, rd ???? th
t ???????????????????????????? ???? 28 29 30 31
T ??????? Time zone ???? 3 ???????? ???? EST
U ????????????????????? 1 ?.?. ?.?.1970 ?????????????
w ??????????????????????????????????? 0 ????????????? 1 ???????????? 6 ???????????
y ?????? ?.?. ??????? 2 ???????? 05
9
FORMAT
Code ????????
Y ?????? ?.?. ??????? 4 ???????? 2005
z ??????????????????? ??? 0 ??? 365
Z ???????????? Time zone ???????? ??? -43200 ??? 43200
10
Example date()
Mon 26 December 2005
  • lt?php
  • echo "lth1gt"
  • echo date("D j F Y")
  • echo "lt/h1gt"
  • ?gt

11
?????????????? getdate()
array getdate(int timestamp)
??????
  • ????????????????????????????????????????? date()
    ?????????????????????????????????????

timestamp ??????????????????????
12
FORMAT
Key ????????
seconds ?????? ??????????
minutes ???? ??????????
hours ??????? ??????????
mday ??????????????? ??????????
wday ????????????????? ??????????
mon ????? ??????????
year ?? ??????????
13
FORMAT
Key ????????
yday ???????????? ??????????
weekaday ????????????????? ????????????
month ????? ????????????
14
Example getdate()
December 26 2005
  • lt?php
  • today getdate()
  • month today"month"
  • mday today"mday"
  • year today"year"
  • echo "lth1gt"
  • echo month . " " . mday . " " . year
  • echo "lt/h1gt"
  • ?gt

15
Example getdate()
Time 195217
  • lt?php
  • time getdate()
  • hour time "hours"
  • minute time "minutes"
  • second time "seconds"
  • echo "lth1gt"
  • echo "Time " . hour . "" . minute . "" .
    second
  • echo "lt/h1gt"
  • ?gt

16
?????????????? checkdate()
int checkdate(int month, int day, int year)
??????
  • ?????????????????????????????????????????????

month ????????????? 1-12
day ????????????? 1-31
year ????????
17
Example getdate()
Incorrect Date!!
  • lt?php
  • if(checkdate(31, 10, 2005)) echo "Correct
    Date!!"
  • else echo "Incorrect Date!!"
  • ?gt

18
????????????????????????????????????????
Show Thai Date 12/31/2005 31 ?.?. 2548
  • lt?php
  • function dateTHAI(date)
  • year substr("date", 0, 4)
  • year year 543
  • thaimonth array("?.?.", "?.?.", "??.?.",
    "??.?.", "?.?.", "??.?.", "?.?.", "?.?.", "?.?.",
    "?.?.", "?.?.", "?.?.")
  • month substr("date", 4, 2)
  • month (int)month - 1
  • month thaimonthmonth

19
????????????????????????????????????????
  • day substr("date", 6, 2)
  • return (int)day . " " . month . " " . year
  • // end function
  • echo "Show Thai Date ltbr/gt"
  • echo "12/31/2005 " . dateTHAI('20051231')
  • ?gt
Write a Comment
User Comments (0)
About PowerShow.com