Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6471219
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:11:56+00:00 2026-05-25T06:11:56+00:00

So i have a field that datatype is a text which is feed into

  • 0

So i have a field that datatype is a text which is feed into the database. What it returns is something along the lines of this:

ddd MMM dd hh:mm:ss yyyy

What i would like for it to do is be displayed as something like this:

ddd MMM dd yyyy hh:mm:ss

I can achive this by using Format() which would look like this:

Format(alarmdet.AlarmStart, "ddd MMM dd yyyy hh:mm:ss) AS AlarmDateTime

So that is all well and good, however; i want to beable to convert this value into a datetime. I’ve tried using CVDate, CDate, DateValue and every time i get returned an error claiming a mismatched datatype. How would i go about converting this exact string into a datetime?

Note:

So you are aware, i am able to get it to convert successfully when in the English(united states) locale, but i am attempting to get this to work in the Portuguese(portugal) locale. In this locale i get the mismatch datatype error which i think has something to do with how access reads the abrivated months. Is there something i am missing to make this successfully work in an international setting?

Also i would like to convert something similar to this in a different field to have it appear as so:

MM/dd/yyyy

Again i know i can get this using Format(), but i would like to to be converted into a DateTime. How would i go about doing this?

Any help or suggestions are greatly appreciated.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:11:57+00:00Added an answer on May 25, 2026 at 6:11 am

    Seems to me the first challenge is reading your custom string as a valid date. In your previous question, you gave this as a sample string stored in your [AlarmStart] field:

    Tue Jan 18 10:10:57 2011
    

    The problem is VBA doesn’t recognize that string as containing a valid Date/Time value.

    ? IsDate("Tue Jan 18 10:10:57 2011")
    False
    

    However, if you revise that string (drop the day of the week and move year before time), you can produce a string which VBA recognizes as a valid date.

    ? IsDate("Jan 18 2011 10:10:57")
    True
    

    So you can use a function to split apart the string, rearrange the pieces you need, and return a Date/Time value.

    Public Function DateFromCustomString(ByVal pIn As String) As Variant
        Dim varPieces As Variant
        Dim strNew As String
        Dim varReturn As Variant
    
        varPieces = Split(pIn)
        strNew = Join(Array(varPieces(1), varPieces(2), varPieces(4), _
            varPieces(3)), " ")
        If IsDate(strNew) Then
            varReturn = CDate(strNew)
        Else
            varReturn = Null
        End If
        DateFromCustomString = varReturn
    End Function
    

    (The Split() and Join() functions are available starting with Access 2000.)

    And, once you have a Date/Time value from your string, you can use the Format() function to display it however you like.

    Format(DateFromCustomString(alarmdet.AlarmStart), "ddd MMM dd yyyy hh:mm:ss") AS AlarmDateTime
    Format(DateFromCustomString(alarmdet.AlarmStart), "mm/dd/yyyy") AS AlarmDate
    

    This works as described with English month name abbreviations. I don’t know what will happen with Portuguese.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this great function that parses a field into a pivot table consisting
I have field X that contains text with spaces in the end of the
I have a field that is in this format 5551112391^HUMAN^HUMAN-800-800^6-main^^ How would I only
I have an input field that is by default set to type=text so that
I have a text field that can be 30 characters in length, however it
I have one field that I need to sum lets say named items However
I have a field that indicates whether someone wars a commission or a fee.
In my asp.net-mvc website I have a field that usually has a string (from
I'm using SQL Server 2005. I have a field that must either contain a
I have got a field that has been setup to allow for Null, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.