HomeVb.Net

Tutorial Vb.Net : Format DateTime Vb.Net System.DateTime

Tutorial Belajar Vb.Net pemula : Format DateTime Vb.Net, merubah format datetime (tanggal) System.DateTime di vb.net, tutorial vb.net khusus pemula di sector code

The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception
Microsoft .NET Framework Error : Unhandled exception has occurred in your application
Visual Studio : No exports were found that match the constraint VS 2012, 2013, 2015
Belajar Vb.Net Pemula - Mengubah format tanggal menggunakan DateTime dari vb.net menggunakan DataType System.DateTime .NET, Seperti yang kita ketahui value dari DateTime berisi nilai tanggal, nilai waktu, atau tanggal dan waktu. Nilai default dari DateTime adalah 00:00:00 (tengah malam) pada tanggal 1 Januari 0001. Sedangkan untuk Class DateAndTime memiliki value Sekarang dan Hari ini. Tutorial vb.Net sebelumnya yang sudah kami bahas antara lain :
  1. Belajar Vb.Net : Looping Statement Vb.Net Lengkap
  2. CRUD VB.Net (Create,Read,Update, Delete) Database Ms Access 
  3. Tutorial VB.NET : CRUD (Create, Update, Delete) Vb.Net Database MySQL 
Silahkan baca-baca juga ya, nah untuk sekarang kita akan membahas penggunaan dan format DateTime
Tutorial Vb.Net : Format DateTime Vb.Net System.DateTime

Properties dan Methods DateTime Vb.Net

Berikut beberapa Properties dan Methods yang dapat digunakan pada DateTime dalam vb.net :
Properties
Description
Date
Berisi Value tanggal
Day
Berisi Value Hari dalam bulan
DayOfWeek
Value awal minggu
DayOfYear
Value awal tahun
Hour
Value jam
Kind
Value waktu setempat, Coordinated Universal Time (UTC), atau tidak.
Millisecond
Value dari milli detik
Minute
Value menit dalam jam
Month
Value bulan
Now
Value dari tanggal dan waktu komputer
Second
Value detik
Ticks
Value Ticks dari tanggal dan waktu
TimeOfDay
Value waktu hari ini
Today
Value tanggal hari ini
UtcNow
Value tanggal dan waktu dan dinyatankan sebagai Coordinated Universal Time (UTC) sekarang
Year
Value tahun

Membuat Object DateTime

Module Module1

    Sub Main()
        Dim tanggal1 As New Date(2015, 11, 6, 12, 0, 0)
        Dim tanggal2 As Date = #11/12/2015 12:00:52 AM#
        Dim tanggal3 As Date = Date.Now
        Dim tanggal4 As Date = Date.UtcNow
        Dim tanggal5 As Date = Date.Today
        Console.WriteLine(tanggal1)
        Console.WriteLine(tanggal2)
        Console.WriteLine(tanggal3)
        Console.WriteLine(tanggal4)
        Console.WriteLine(tanggal5)
        Console.ReadKey()
    End Sub

End Module
Maka akan menghasilkan nilai sebagai berikut:
06/11/2015 12.00.00
12/11/2015 00.00.52
06/11/2015 10.35.12
06/11/2015 03.35.12
06/11/2015 00.00.00

Mendapatkan Value Tanggal dan Waktu Sekarang

Module Module1

    Sub Main()
        Console.Write("Waktu sekarang adalah : ")
        Console.WriteLine(Now.ToLongTimeString)
        Console.ReadKey()
    End Sub

End Module
Akan menghasilkan nilai : "Waktu sekarang adalah : 10.37.47"
Sedangkan untuk menampilkan tanggal sekarang sebagai berikut :
Module Module1

    Sub Main()
        Console.WriteLine("Tanggal sekarang adalah : ")
        Dim tanggal As Date = Today
        Console.WriteLine(tanggal)
        Console.ReadKey()
    End Sub

End Module
Akan menghasilkan pesan : "Tanggal sekarang adalah :
06/11/2015 00.00.00"

Format Date di VB.NET
Berikut contoh format tanggal yang sering kita gunakan.
Module Module1

    Sub Main()
        Console.WriteLine("Belajar format tanggal vb.net bersama sector code :")
        Dim SCnow As New Date(2015, 11, 6, 0, 0, 0)
        Console.WriteLine(" Date Format 'd:' " & SCnow.ToString("d"))
        Console.WriteLine(" Date Format 'D:' " & SCnow.ToString("D"))
        Console.WriteLine(" Date Format 't:' " & SCnow.ToString("t"))
        Console.WriteLine(" Date Format 'T:' " & SCnow.ToString("T"))
        Console.WriteLine(" Date Format 'f:' " & SCnow.ToString("f"))
        Console.WriteLine(" Date Format 'F:' " & SCnow.ToString("F"))
        Console.WriteLine(" Date Format 'g:' " & SCnow.ToString("g"))
        Console.WriteLine(" Date Format 'G:' " & SCnow.ToString("G"))
        Console.WriteLine(" Date Format 'M:' " & SCnow.ToString("M"))
        Console.WriteLine(" Date Format 'R:' " & SCnow.ToString("R"))
        Console.WriteLine(" Date Format 'y:' " & SCnow.ToString("y"))
        Console.ReadKey()
    End Sub

End Module
maka akan menghasilkan pesan :
Belajar format tanggal vb.net bersama sector code :
 Date Format 'd:' 06/11/2015
 Date Format 'D:' Jumat, 06 November 2015
 Date Format 't:' 00.00
 Date Format 'T:' 00.00.00
 Date Format 'f:' Jumat, 06 November 2015 00.00
 Date Format 'F:' Jumat, 06 November 2015 00.00.00
 Date Format 'g:' 06/11/2015 00.00
 Date Format 'G:' 06/11/2015 00.00.00
 Date Format 'M:' 6 November
 Date Format 'R:' Fri, 06 Nov 2015 00:00:00 GMT
 Date Format 'y:' November 2015
Selamat mencoba.

Feel free to code it up and send us a pull request.

Hi everyone, let's me know how much this lesson can help your work. Please Subscribe and Follow Our Social Media 'kodeajaib[dot]com' to get Latest tutorials and will be send to your email everyday for free!, Just hit a comment if you have confused. Nice to meet you and Happy coding :) all ^^



Follow by E-Mail


COMMENTS

DISQUS
Name

ADO.NET,3,Ajax,6,Android,9,AngularJS,4,ASP.NET,4,Blogger Tutorials,7,Bootstrap,7,C++,1,Codeigniter,2,Cplusplus,6,Crystal Report,6,CSharp,25,Ebook Java,2,FlyExam,1,FSharp,3,Game Development,2,Java,35,JDBC,2,Laravel,89,Lumen,2,MariaDB,2,Ms Access,3,MySQL,31,ODBC,6,OleDB,1,PHP,14,PHP Framework,6,PHP MYSQLI,9,PHP OOP,5,Python,8,Python 3,4,SQL Server,4,SQLite,4,Uncategorized,5,Vb 6,2,Vb.Net,89,Video,48,Vue Js,4,WPF,2,Yii,3,
ltr
item
KODE AJAIB: Tutorial Vb.Net : Format DateTime Vb.Net System.DateTime
Tutorial Vb.Net : Format DateTime Vb.Net System.DateTime
Tutorial Belajar Vb.Net pemula : Format DateTime Vb.Net, merubah format datetime (tanggal) System.DateTime di vb.net, tutorial vb.net khusus pemula di sector code
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEQS0N5w-ripOibreiYdZhl3gkI1X0sm_ItxPfw4xEWwXkWIASy_YVl548-rz_1_DhrjHgGI9BO6LIluRASjTgEqgiev2-ju2-7KD1ihhyW1gRuVD-EezKzh29G6s7mp4wIIHOvEnruxY/s320/date-time-format-vbnet.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEQS0N5w-ripOibreiYdZhl3gkI1X0sm_ItxPfw4xEWwXkWIASy_YVl548-rz_1_DhrjHgGI9BO6LIluRASjTgEqgiev2-ju2-7KD1ihhyW1gRuVD-EezKzh29G6s7mp4wIIHOvEnruxY/s72-c/date-time-format-vbnet.jpg
KODE AJAIB
https://scqq.blogspot.com/2015/11/tutorial-vbnet-format-datetime-vbnet.html
https://scqq.blogspot.com/
https://scqq.blogspot.com/
https://scqq.blogspot.com/2015/11/tutorial-vbnet-format-datetime-vbnet.html
true
3214704946184383982
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy