[RESOLVED] Globalization.PersianCalendar , getting file date creation ?
Greetings.
any way to convert file creation date to Shamsi calender ?
I use
Code:
Public Shamsi As New Globalization.PersianCalendar
and via this declaration, I can get current time of machine in Shamsi format. But how to use it so as to convert a date ?
Thanks in advanced
Re: Globalization.PersianCalendar , getting file date creation ?
Self-solved : (easier than it looked)
Code:
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim fileCreatedDate As DateTime = File.GetCreationTime("C:\test.txt")
Label1.Text = ConverttoShamsi(fileCreatedDate)
End Sub
Private Function ConverttoShamsi(CreationdateTime As Date) As string ' defining it As string makes it shown in Shamsi calender format
Try
Return Shamsi.GetYear(CreationdateTime) & "/" & Shamsi.GetMonth(CreationdateTime) & "/" & Shamsi.GetDayOfMonth(CreationdateTime) & " " & Shamsi.GetHour(CreationdateTime) & ":" & Shamsi.GetMinute(CreationdateTime) & ":" & Shamsi.GetSecond(CreationdateTime)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function