Results 1 to 2 of 2

Thread: [RESOLVED] Globalization.PersianCalendar , getting file date creation ?

  1. #1

    Thread Starter
    Addicted Member GlowingVB's Avatar
    Join Date
    Feb 2014
    Posts
    234

    Resolved [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

  2. #2

    Thread Starter
    Addicted Member GlowingVB's Avatar
    Join Date
    Feb 2014
    Posts
    234

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width