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 7802699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:20:01+00:00 2026-06-02T01:20:01+00:00

I parse a date that is in string format and would like to convert

  • 0

I parse a date that is in string format and would like to convert it to a datetime format but cannot figure out how to do this.
The date appears as such;

Wed April 18 08:00:04 +08:00 2012

and would like it in a simple form of

2012-04-18 08:00:00 

Code:

Dim postDate As DateTime
Dim provider As CultureInfo = CultureInfo.InvariantCulture

contentDate = Regex.Replace(contentDate, "\+", "")
Dim format As String = "ddd MMMM dd HH:mm:ss zzz yyyy"
postDate = DateTime.ParseExact(contentDate, format, provider)
contentDate = postDate.ToString("yyyy-MM-dd hh:mm:ss tt")

any ideas appreciated

  • 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-06-02T01:20:02+00:00Added an answer on June 2, 2026 at 1:20 am
    var format = "ddd MMMM dd H:mm:ss zzz yyyy";
    var culture = System.Globalization.CultureInfo.InvariantCulture;
    DateTime date = DateTime.ParseExact(dateString.Trim(), format, culture);
    

    Will parse the date format you provided. Note that that the above format string assumes the date format you’re parsing uses two digits for days that are less than 10, ie. April 01.

    date.ToString("yyyy-MM-dd hh:mm:ss tt");
    

    Will produce the desired output date format.

    For reference you should look at the MSDN documentation for DateTime.ParseExact() and Custom Date and Time Format Strings.

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

Sidebar

Related Questions

datetime parse work exactly when date format is like mm/dd/yyyy but when dateformat is
Hello I have an unusual date format that I would like to parse into
I am trying to parse a date that looks like this: 2010-04-05T17:16:00Z This is
I have a date string that I am able to parse and format with
I've been working on a regexp, that would parse a date from the format
I'm trying to parse a date/time string using DateTime.ParseExact . It works everywhere, except
I have this code snippet: DateFormat formatter1; formatter1 = new SimpleDateFormat(mm/DD/yyyy); System.out.println((Date)formatter1.parse(08/16/2011)); When I
I would like to create a function which validates a date string. My module
in Java, how to parse a date string that contains a letter that does
I need to convert a String like 2010-11-28 into Date type to be saved

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.