Month from DateStamp in a Text-field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to get a Month-field in month-name instead of digit from a DateStamp
which is a TEXT-field (not created by me, an imported file),
e.g. dateStamp (TEXT):

2007-03-09-02.49.21.534728

I did a new field for the Month like this:

NewFieldName: Month(Left([myDateStampField],7))

it worked out fine with a 3 in the field not March. I am using Access 2003.
I knew I had something missing in order to get the name of the month.
I tried adding , "mmmm" after the 7)
hoping to get March, but it didn't work, please somebody helps me what
should I do.

thanks
karen
 
I want to get a Month-field in month-name instead of digit from a DateStamp
which is a TEXT-field (not created by me, an imported file),
e.g. dateStamp (TEXT):

2007-03-09-02.49.21.534728

I did a new field for the Month like this:

NewFieldName: Month(Left([myDateStampField],7))

it worked out fine with a 3 in the field not March. I am using Access 2003.
I knew I had something missing in order to get the name of the month.
I tried adding , "mmmm" after the 7)
hoping to get March, but it didn't work, please somebody helps me what
should I do.

thanks
karen

If it were a Date/Time field all you would need is...

NewFieldName: Format([myDateStampField],"mmmm")

As Text datatype, try it this way:

NewNameField:Format(DateSerial(Left([myDateStampField],4),Mid([myDateStampField],6,2),1),"mmmm")

Or you can use:

NewNameField:MonthName(Mid([myDateStampField],6,2))
 
Karen,

This sounds like a follow on to your earlier question. Use the format
function in conjunction with the calculation that worked for you

Format(CDate(Left([YourField],10)),"mmmm")

or really paranoid

IIF(IsDate(LEFT([YourField],10)),Format(CDate(Left([YourField],10)),"mmmm"),Null)




'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
Wonderful! thanks a million!
Karen

fredg said:
I want to get a Month-field in month-name instead of digit from a DateStamp
which is a TEXT-field (not created by me, an imported file),
e.g. dateStamp (TEXT):

2007-03-09-02.49.21.534728

I did a new field for the Month like this:

NewFieldName: Month(Left([myDateStampField],7))

it worked out fine with a 3 in the field not March. I am using Access 2003.
I knew I had something missing in order to get the name of the month.
I tried adding , "mmmm" after the 7)
hoping to get March, but it didn't work, please somebody helps me what
should I do.

thanks
karen

If it were a Date/Time field all you would need is...

NewFieldName: Format([myDateStampField],"mmmm")

As Text datatype, try it this way:

NewNameField:Format(DateSerial(Left([myDateStampField],4),Mid([myDateStampField],6,2),1),"mmmm")

Or you can use:

NewNameField:MonthName(Mid([myDateStampField],6,2))
 
Amazing, I learned so much for the same target! Thanks.
Yes, John, you are right it was a follow up question because I am busy on
the same data base.
I am glad you replied to me on this question, then I can use the same format
to work out the year!

thanks All,
Karen


John Spencer said:
Karen,

This sounds like a follow on to your earlier question. Use the format
function in conjunction with the calculation that worked for you

Format(CDate(Left([YourField],10)),"mmmm")

or really paranoid

IIF(IsDate(LEFT([YourField],10)),Format(CDate(Left([YourField],10)),"mmmm"),Null)




'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================

I want to get a Month-field in month-name instead of digit from a DateStamp
which is a TEXT-field (not created by me, an imported file),
e.g. dateStamp (TEXT):

2007-03-09-02.49.21.534728

I did a new field for the Month like this:

NewFieldName: Month(Left([myDateStampField],7))

it worked out fine with a 3 in the field not March. I am using Access 2003.
I knew I had something missing in order to get the name of the month.
I tried adding , "mmmm" after the 7)
hoping to get March, but it didn't work, please somebody helps me what
should I do.

thanks
karen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top