Question

i'm working on a microsoft access DB with a column with values in the format Jan-2013, Feb-2014, May-2015.

Is it possible to convert those values to a valid datetime value from an Access select query? Only the month and year are important so day can be taken as just the first day of the month specified.

Était-ce utile?

La solution

This works in Russian locale, so i suppose English will be good too:

cdate("01-" & [FieldWithMM-YYYY])

Autres conseils

Since your fine using the first day of the month you can use DateValue to tag "the first" to the start of your existing string

Dim newDate as Date
newDate = DateValue("01-" & yourDateColumn)

or

Select DateValue("01-" & yourDateColumn) as FormattedAsADateNow
From yourTable

If you have nulls you'll need to protect against those or this will give a Type Mismatch.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top