Suche senden
Hochladen
2 cách lấy ngày giờ theo định dạng
•
Als PPTX, PDF herunterladen
•
0 gefällt mir
•
283 views
T
truong nguyen
Folgen
2 cách lấy ngày giờ theo định dạng
Weniger lesen
Mehr lesen
Technologie
Melden
Teilen
Melden
Teilen
1 von 3
Jetzt herunterladen
Empfohlen
Introduction to FPDF
Introduction to FPDF
Jeremy Curcio
Pdf's in PHP
Pdf's in PHP
Gert Poppe
Reporting using FPDF
Reporting using FPDF
Mudasir Syed
PHP - Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
File Uploading in PHP
File Uploading in PHP
Idrees Hussain
Uploading a file with php
Uploading a file with php
Muhamad Al Imran
php file uploading
php file uploading
Purushottam Kumar
Music Downloading Website (HTML,CSS,PHP Presentation)
Music Downloading Website (HTML,CSS,PHP Presentation)
Anil Kumar
Empfohlen
Introduction to FPDF
Introduction to FPDF
Jeremy Curcio
Pdf's in PHP
Pdf's in PHP
Gert Poppe
Reporting using FPDF
Reporting using FPDF
Mudasir Syed
PHP - Introduction to PHP Fundamentals
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
File Uploading in PHP
File Uploading in PHP
Idrees Hussain
Uploading a file with php
Uploading a file with php
Muhamad Al Imran
php file uploading
php file uploading
Purushottam Kumar
Music Downloading Website (HTML,CSS,PHP Presentation)
Music Downloading Website (HTML,CSS,PHP Presentation)
Anil Kumar
How ai is evolving from science fiction into
How ai is evolving from science fiction into
truong nguyen
Web security
Web security
truong nguyen
Accessibility
Accessibility
truong nguyen
Accessibility
Accessibility
truong nguyen
Web programming technologies
Web programming technologies
truong nguyen
Hướng dẫn thiết kế web bằng jsp –
Hướng dẫn thiết kế web bằng jsp –
truong nguyen
Tổng quan về struts framework, mvc
Tổng quan về struts framework, mvc
truong nguyen
Tự học jsp !
Tự học jsp !
truong nguyen
Tổng quan về jsp
Tổng quan về jsp
truong nguyen
Weitere ähnliche Inhalte
Mehr von truong nguyen
How ai is evolving from science fiction into
How ai is evolving from science fiction into
truong nguyen
Web security
Web security
truong nguyen
Accessibility
Accessibility
truong nguyen
Accessibility
Accessibility
truong nguyen
Web programming technologies
Web programming technologies
truong nguyen
Hướng dẫn thiết kế web bằng jsp –
Hướng dẫn thiết kế web bằng jsp –
truong nguyen
Tổng quan về struts framework, mvc
Tổng quan về struts framework, mvc
truong nguyen
Tự học jsp !
Tự học jsp !
truong nguyen
Tổng quan về jsp
Tổng quan về jsp
truong nguyen
Mehr von truong nguyen
(9)
How ai is evolving from science fiction into
How ai is evolving from science fiction into
Web security
Web security
Accessibility
Accessibility
Accessibility
Accessibility
Web programming technologies
Web programming technologies
Hướng dẫn thiết kế web bằng jsp –
Hướng dẫn thiết kế web bằng jsp –
Tổng quan về struts framework, mvc
Tổng quan về struts framework, mvc
Tự học jsp !
Tự học jsp !
Tổng quan về jsp
Tổng quan về jsp
2 cách lấy ngày giờ theo định dạng
1.
2 cách lấy
ngày giờ theo định dạng ở Java
2.
Cách 1: PHP: import java.util.Calendar; import
java.text.SimpleDateFormat; public class DateUtils { public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; public static String now() { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT_NOW); return sdf.format(cal.getTime()); } public static void main(String arg[]) { System.out.println("Now : " + DateUtils.now()); } }
3.
Cách 2: PHP: import java.util.Calendar; import
java.text.SimpleDateFormat; public class DateUtils { public static String now(String dateFormat) { Calendar cal = Calendar.getInstance(); SimpleDateFormat sdf = new SimpleDateFormat(dateFormat); return sdf.format(cal.getTime()); } public static void main(String arg[]) { System.out.println(DateUtils.now("dd MMMMM yyyy")); System.out.println(DateUtils.now("yyyyMMdd")); System.out.println(DateUtils.now("dd.MM.yy")); System.out.println(DateUtils.now("MM/dd/yy")); System.out.println(DateUtils.now("yyyy.MM.dd G 'at' hh:mm:ss z")); System.out.println(DateUtils.now("EEE, MMM d, ''yy")); System.out.println(DateUtils.now("h:mm a")); System.out.println(DateUtils.now("H:mm:ss:SSS")); System.out.println(DateUtils.now("K:mm a,z")); System.out.println(DateUtils.now("yyyy.MMMMM.dd GGG hh:mm aaa")); } }
Jetzt herunterladen