[Gambas-user] IsDate(string) - how good is it?
bb
adamnt42 at gmail.com
Thu Jan 6 11:55:45 CET 2022
On Thu, 2022-01-06 at 10:36 +0100, Gianluigi wrote:
> Il giorno gio 6 gen 2022 alle ore 09:44 Gianluigi
> <bagonergi at gmail.com> ha
> scritto:
>
> >
> >
> > Il giorno gio 6 gen 2022 alle ore 09:39 Gianluigi
> > <bagonergi at gmail.com>
> > ha scritto:
> >
> > >
> > >
> > > Il giorno gio 6 gen 2022 alle ore 09:15 bb <adamnt42 at gmail.com>
> > > ha
> > > scritto:
> > >
> > > > By that I mean, what type of strings can be interpreted as a
> > > > date?
> > > >
> > > > For example, IsDate("1/Jan/2022") returns false.
> > > >
> > > > I am trying to determine whether a gridview cell is actually a
> > > > date,
> > > > but gridviews only have string contents. My human brain
> > > > immediately
> > > > interprets that string as a date but IsDate doesn't. So what
> > > > are the
> > > > "limits" of what IsDate() can interpret?
> > > >
> > > > b
> > > >
> > > >
> > > > ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
> > > >
> > >
> > > Have you tried like this: IsDate(Val("1/Jan/2022")) ?
> > >
> >
> > Sorry: IsDate(Str(Val("1/Jan/2022")))
> >
>
> In fact it is obtained from very winding passages, boh!
>
> es.
> [code]
> Private hGrid As GridView
>
> Public Sub Form_Open()
>
> Dim aHeaders As String[] = ["DATE", "ID", "MIKEY", "MINNIE"]
> Dim hPan As HBox
> Dim hButton As Button
> Dim hDate As Date
>
> hGrid = New GridView(Me) As "GridView1"
>
> With Me
> .H = 512
> .W = 512
> .Arrangement = Arrange.Vertical
> .Margin = True
> End With
> With hGrid
> .Resizable = True
> '.AutoResize = True
> .Expand = True
> .Header = GridView.Horizontal
> .Rows.Count = 10
> .Columns.Count = aHeaders.Count
> .Columns[0].Width = 10
> End With
>
> For i As Integer = 0 To aHeaders.Max
> hGrid.Columns[i].Title = aHeaders[i]
> Next
> For i = 0 To 9
> hDate = Date(Year(Now), Month(Now - i), Day(Now - i))
> hGrid[i, 0].text = Format(hDate, "dd/mmm/yyyy")
> Next
> hGrid.Columns.Width = -1
>
> With hPan = New HBox(Me)
> .h = 40
> End With
> With hButton = New Button(Me) As "Button1"
> .h = 40
> .AutoResize = True
> .Text = "CLICK HERE"
> End With
>
> End
>
> Public Sub Button1_Click()
> ' IsDate(Str(Val("1/Jan/2022")))
> Dim hDate As Date = Date(Val(hGrid[0, 0].text))
>
> Print IsDate(Str(hDate))
> ' Print IsDate(Str(Date(Now)))
>
> End
> [code]
>
> Regards
> Gianluigi
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
Egad! Is that really code or is it your Nona's recipe for Tagliatelle
Putranesca?
😁️
b
More information about the User
mailing list