Avatar of Ernesto
Ernesto
Flag for Mexico asked on

Day in text format

Hi all
i got

cie as date
cie.ToString("dd/MM/yyy")

result

14/03/2019

I need

Jueves 14 de Marzo del 2019
trans

Thursday 14 of march of 2019

or some like that, the needment is that give me the day as text format
"thursday"

tsm experts
Visual Basic.NET.NET Programming

Avatar of undefined
Last Comment
Ernesto

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
it_saige

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ernesto

ASKER
Ok let me see
i think i catch it
it_saige

What do you mean?
it_saige

You mean you need to read the date and parse from a label?  Just get the Text property of the label and feed it to either TryParse or TryParseExact; e.g. -
Imports System.Globalization

Module Module1
    Sub Main()
        Dim [date] As DateTime
        Dim culture As CultureInfo = CultureInfo.GetCultureInfo("es-ES")
        Dim data As String = "jueves 14 de marzo del 2019"
        If DateTime.TryParseExact(data, "dddd dd \de MMMM \del yyyy", culture, DateTimeStyles.None, [date]) Then
            Console.WriteLine([date].ToString("dddd dd o\f MMMM o\f yyyy", CultureInfo.CurrentCulture))
        Else
            Console.WriteLine("Could not convert date")
        End If
        Console.ReadLine()
    End Sub
End Module

Open in new window

Which produces the following output -Capture.PNG-saige-
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
Arana (G.P.)

Ernesto utiliza

WeekdayName(Weekday(cie))

Saludos.
Ernesto

ASKER
arana, dont give me nothing
Ernesto

ASKER
i got

15/03/2019 in a  datetime var

want in another var

Viernes 15 de Marzo de 2019
transcript...
Friday, March 15 2019

but that var is changing as any date scrolling the database, is not fixed value
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
it_saige

Just assign the result of the ToString method to a variable; e.g. -
Imports System.Globalization

Module Module1
    Sub Main()
        Dim dates = Enumerable.Range(0, 10).Select(Function(i) DateTime.Now.AddDays(-(i * 9)))
        Dim culture As CultureInfo = CultureInfo.GetCultureInfo("es-ES")
        For Each [date] In dates
            Dim output As String = [date].ToString("dddd dd \de MMMMM \del yyyy", culture)
            Console.WriteLine(output)
        Next
        Console.ReadLine()
    End Sub
End Module

Open in new window

Which produces the following output -Capture.PNG-saige-
Ernesto

ASKER
Oh men!
tsm
regards