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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T09:06:03+00:00 2026-05-14T09:06:03+00:00

I am using glibs functions to convert epoch time to string as follows. But

  • 0

I am using glibs functions to convert epoch time to string as follows.
But each time it is giving me some random time.

//Convert Time in string.
GDate *date = g_date_new_julian(timestampsecs);
gchar date_string[50];
g_date_strftime(date_string, 50, (const gchar*)"%a, %I:%M %p", (const GDate*)date);
printf("Date String [%s]\n", date_string );

Why this might be happening? am i missing anything?

Thanks,
PP.

UPDATE:

As said i tried with setlocale(LC_ALL, ""); following is the output,
It is the same as i was getting before using setlocale.

(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279703  computed dmy: 66 4293563716 187
Date String Tik_INDEX[1] [1272279703] --> [Tue, 12:00 AM]

(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279717  computed dmy: 80 4293563716 187
Date String Tik_INDEX[2] [1272279717] --> [Tue, 12:00 AM]

(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279720  computed dmy: 53 4293563717 187
Date String Tik_INDEX[3] [1272279720] --> [Fri, 12:00 AM]

(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279721  computed dmy: 54 4293563717 187
Date String Tik_INDEX[4] [1272279721] --> [Sat, 12:00 AM]

(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279721  computed dmy: 54 4293563717 187
Date String Tik_INDEX[5] [1272279721] --> [Sat, 12:00 AM]

(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279722  computed dmy: 55 4293563717 187
Date String Tik_INDEX[6] [1272279722] --> [Sun, 12:00 AM]

(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279723  computed dmy: 56 4293563717 187
Date String Tik_INDEX[7] [1272279723] --> [Mon, 12:00 AM]

(MyTestApp:7747): GLib-WARNING **:
OOPS julian: 1272279724  computed dmy: 57 4293563717 187
Date String Tik_INDEX[8] [1272279724] --> [Tue, 12:00 AM]
  • 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-14T09:06:03+00:00Added an answer on May 14, 2026 at 9:06 am

    You probably want to call setlocale() first, “LC_ALL” should do it. POSIX should also work, not sure about C.

    g_date_strftime() is influenced by the locale setting. Its also good to store the result of g_date_strftime(), or anything else that fills a static buffer. You’ll want to know how many bytes were actually printed to the buffer.

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

Sidebar

Related Questions

No related questions found

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.