mktime Questions

1

Solved

Considering local time. In testing some time code with the potential hundreds of time zones, some of them result in a mktime() call that never returns for select values! Detail: Code never returns ...
Cacie asked 2/9, 2024 at 1:48

7

Solved

Am am current facing a problem that need a solution ASAP. I am trying to list all months of the year by using the following code: for ($m = 1; $m <= 12; $m++) { $month = date('F', mktime(0, 0, ...
Friede asked 31/5, 2012 at 7:48

19

Solved

I want to take a date and work out its week number. So far, I have the following. It is returning 24 when it should be 42. <?php $ddate = "2012-10-18"; $duedt = explode("-",$ddate); $date = mk...
Boigie asked 5/3, 2012 at 13:45

4

Solved

I am executing below code. int main() { struct tm storage={0,0,0,0,0,0,0,0,0}; char *p = NULL; p = (char *)strptime("2012-08-25 12:23:12","%Y-%m-%d %H:%M:%S",&storage); char buff[1024]={0}; ...
Lindsley asked 25/8, 2012 at 12:45

3

While answering another question, I told the OP he needs to initialize his struct tm variable correctly but needs to be careful because he couldn't simply use struct tm mytime; memset(&mytime,...
Honeybunch asked 13/7, 2015 at 10:10

4

What I would like to do with my simple program is to calculate a difference in seconds between two dates. time_t referenceDate; time_t dateNow = time(0); struct tm referenceDateComponent = {0}; re...
Bezonian asked 17/7, 2015 at 11:11

2

Solved

When you call mktime(), Feb 1 seems to come before Jan 31. Why is this? Am I doing something wrong or is this a bug in glibc? Here's the code: struct tm tm; time_t tt; memset(&tm, 0, sizeof(...
Garrott asked 2/2, 2011 at 20:10

2

Solved

I'm working on some time related features and I opt to always use UTC times and store time stamps as integers for consistency. However, I noticed that when I use mktime it seems that the currently...
Galleywest asked 18/3, 2016 at 23:31

3

Solved

I saw a lot of different views so thought of asking here. I read man mktime: (A positive or zero value for tm_isdst causes mktime() to presume initially that summer time (for example, Daylight ...
Blindworm asked 19/12, 2011 at 8:50

4

Solved

I'm trying to use PHP to create a script that searches all the days between now and one year's time and lists all the dates for Fridays and Saturdays. I was trying to use PHP's date() and mktime() ...
Neysa asked 28/10, 2010 at 16:9

1

Solved

I have been playing with mktime, and I noticed a weird, and inconsistent, behavior. I provide it with a date which is not during DST (daylight saving time), but with tm_isdst is set to 1, what mkt...
Cataplasia asked 6/12, 2013 at 0:44

8

Solved

Hay, i have a database holding events. There are 2 fields 'start' and 'end', these contain timestamps. When an admin enters these dates, they only have the ability to set the day,month,year. So we ...
Spacious asked 2/11, 2010 at 16:27

2

Solved

I am trying to figure out what's special about March 16th, 1984. On a virtual machine I am using (nothing special about it), Python (as well as PyPy) crashes when trying to use mktime with what see...
Dogwatch asked 23/9, 2013 at 2:29

1

Here is my problem: polyfit does not take datetime values, so that I converted datetime with mktime producing the polynomial fit works z4 = polyfit(d, y, 3) p4 = poly1d(z4) For the plot however...
Nordgren asked 14/7, 2013 at 9:27

1

Solved

Are there any differences between using functions time() and mktime() with default parameters to obtain current timestamp?
Pericynthion asked 28/3, 2013 at 13:18

5

Solved

I am trying to convert a date from dd/mm/yyyy => yyyy-mm-dd. I have using the mktime() function and other functions but I cannot seem to make it work. I have managed to explode the origina...
Glassworker asked 24/4, 2012 at 22:36

1

Solved

I read in two strings with a Year, the Julian Day (year day), hour, minute, and an observation. I pull the relevant variables out using sscanf: sscanf(tide_str1.c_str(), "%d %d %d %d %Lf", &y...
Impracticable asked 5/3, 2012 at 22:38

1

For the first time (in my new dev environment) I'm seeing valgrind complain about mktime, but I'm not sure if this is a bug in the libc library, valgrind, or my code. I'll start with the error (bel...
Kure asked 27/1, 2012 at 17:42

4

Solved

I need help getting the previous months full date range in the following format: Y-m-d I have successfully been able to get "this" months full date range but not the "previous" months full date ra...
Forging asked 1/1, 2012 at 18:57

2

Solved

I am using the mktime(struct tm*) function in Suse 10. Now, I am noticing some strange behaviour when daylight saving time is enabled. Let's say I have enabled daylight saving time to begin on Se...
Quesnay asked 16/9, 2011 at 14:14

2

Solved

the following code: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <sys/time.h> static const char * wday_abb_names[] = ...
Forgiven asked 24/6, 2011 at 12:32

3

Solved

strtotime() in PHP works great if you can provide it with a date format it understands and can convert, but for example you give it a UK date it fails to give the correct unix timestamp. Is there ...
Darrick asked 3/5, 2011 at 15:34

3

Solved

I'm trying to group together dates into a week number and year, and then I want to convert that week number back into a unix timestamp. How can I go about doing this?
Threatt asked 23/4, 2011 at 9:10

3

Solved

I have the following MySQL timestamp: 2009-06-23 16:21:48 How can I convert it to a format like mktime()?
Antofagasta asked 30/6, 2009 at 14:45

4

Solved

I need to query MySQL for the current date (from PHP) in YYYY-MM-DD format... anyone?
Farwell asked 13/5, 2010 at 17:58

© 2022 - 2025 — McMap. All rights reserved.