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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:08:52+00:00 2026-05-14T20:08:52+00:00

What C function should I call to obtain a formatted date and time for

  • 0

What C function should I call to obtain a formatted date and time for the locale where the program is being executed?

I’m asking this question because I have run into a problem using the ClamAV daemon API. The VERSION command returns the date and time of the latest virus definitions, but the code uses a call to ctime to format it. As far as I can tell ctime does not format the datetime according to the current locale and uses the English abbreviations for days of the week and the month in the returned string. This causes problems as my Java program which uses the ClamAV API does respect the current locale and thus expects the day of the week and month name to have the local abbreviations.

The datetime format would need to be in the same format as that produced by ctime:

Www Mmm dd hh:mm:ss yyyy

Where Www is the weekday, Mmm the month in letters, dd the day of the month, hh:mm:ss the time, and yyyy the year.

I could rewrite the Java program to always assume English dates but I’d be happier to submit a patch to ClamAV as it seems like a bug on their side to me.

  • 1 1 Answer
  • 1 View
  • 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-14T20:08:53+00:00Added an answer on May 14, 2026 at 8:08 pm

    strftime("%c", ... should give you the preferred date and time representation for the current locale. Or (still with strftime) you can emulate ctime‘s format but with %b for current-locale month abbreviation, %a for current-locale weekday abbreviation, and so on.

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

Sidebar

Related Questions

My question is about when a function should be referenced with the extern keyword
Should I use textbox.text.Trim() function every time when I insert any data from web
I came across the function InterlockedExchange and was wondering when I should use this
I've heard that the static_cast function should be preferred to C-style or simple function-style
Should the visibility for the __destruct() function be public or something else? I'm trying
I'd like to provide a log out function in a Rails app. Should I
What do you think - which functions should be implemented to make work with
If for example I should not use standard library functions like printf() , putchar()
I read that you should define your JavaScript functions in the <head> tag, but
I'm a bit confused that the argument to crypto functions is a string. Should

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.