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

  • Home
  • SEARCH
  • 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 8578817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:28:46+00:00 2026-06-11T20:28:46+00:00

I am creating a date and time string that is used to timestamp a

  • 0

I am creating a date and time string that is used to timestamp a file saved to the documents directory. Everything is working, except the time keeps displaying as 08/42/43 instead of 08:24:43. I’m not sure where the backslashes are coming from.

Here is the file name I am getting “2012_09_24 _ 08/42/43.cmm.” I added the underscores because I didn’t want backslashes for the date. The only issue is that the time has the backslashes. Here is the actual code.

NSDate *myDate = [NSDate date];
NSDateFormatter *df = [[NSDateFormatter alloc] init];
[df setDateFormat:@"yyyy_MM_dd '_' hh:mm:s"];
NSString *dateForFilename = [df stringFromDate:myDate];
  • 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-11T20:28:47+00:00Added an answer on June 11, 2026 at 8:28 pm

    This happens because ‘:’ is not a valid character for a filename (at least for OSX and hence iOS), so the system fallbacks to ‘/’. If you try something like this it should work ok:

    [df setDateFormat:@"yyyy_MM_dd_hh-mm-s"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an app that should list the date and time when a button
When creating database tables I'm often stumped when trying to name my time/date/timestamp fields.
I'm having an impossible time creating a DateTime object that stores the date 02/29/101
I'm creating a report that lists patient deaths by date and by doctor. There
what is exactly happing when creating a Unix Timestamp from a given date. I
I'm creating a web application that will involve habitual file uploading and retrieval (PDFs,
I am creating a custom .net hardware framework that will be used by other
I have a file that I am creating on the fly like this: //
I'm creating a script that tells me the creation / modification date and other
I am creating web application where I need to store timestamp/ date. The problem

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.