Link to home
Start Free TrialLog in
Avatar of sbornstein2
sbornstein2

asked on

ASP.Net/C# - convert datetime question

We have our oracle database and web server in the EST timezone.  My web application I either need to show GMT to the user or conver the EST datetime to their local datetime, which is my ultimate goal.

Any idea how to do either or?

Thanks
Avatar of vora_bhaumik
vora_bhaumik
Flag of India image

Public Shared Function ConvertoDate(ByVal dateString As String, ByRef result As DateTime) As Boolean
        Try
            Dim supportedFormats() As String = New String() {"MM/dd/yyyy", "MM/dd/yy", "ddMMMyyyy", "dMMMyyyy"}

            result = DateTime.ParseExact(dateString, supportedFormats, System.Globalization.CultureInfo.CurrentCulture, System.Globalization.DateTimeStyles.None)

            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function
ASKER CERTIFIED SOLUTION
Avatar of vora_bhaumik
vora_bhaumik
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sbornstein2
sbornstein2

ASKER

One of the posts is using the DateTime.Now which I can't do as I already have it stored as EST and the other posts are using assuming it is central time to UTC.
this was perfect thank you