Format penulisan bulan

Cara menampilkan bulan adalah sbb:

query:

select month(getdate()) ==> ‘4’

select replace(str(month(getdate()),2),' ','0') as bulan    ==> '04'

C#:

tgl.Date = DateTime.Today;      
string bulan = tgl.Date.Month.ToString();  ==> '4'
string bulan = tgl.Date.Month.ToString("d2");  ==> '04'

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s