Questions tagged [mktime]

mktime is a function that returns the time since the UNIX epoch from a given date and time. Found in C and PHP.

Reference for the C function: https://en.cppreference.com/w/c/chrono/mktime

Reference for the PHP function: https://php.net/manual/en/function.mktime.php

308 questions
-2
votes
3 answers

php convert date to mktime function

I post a date input $_POST['date'] with format 2013/11/22 and time $_POST['time'] with format 10:10 AM. Now I need to put both inputs in the mktime function like this: mktime(10, 10, 0, 11, 22, 2013); How do I create this?
Alex.DX
  • 141
  • 1
  • 4
  • 14
-2
votes
3 answers

struct tm inside another struct - c

I'm trying to calculate the date difference between two dates, using mktime and difftime. One of the dates is a struct tm inside another struct and the other date is a struct tm inside main. mktime works fine one the date inside main, but keeps…
-3
votes
1 answer

PHP Build calendar that loops through until current month

I have a project im working on while learning PHP. I need to create a page that displays a link for a year and the months of that year on one line. Then it breaks and goes to the next year. Continuing this until the current year stopping at the…
aarmfield
  • 67
  • 8
-3
votes
1 answer

PHP | How to find EVERY OTHER SUNDAY from SECOND SUNDAY of THIS YEAR to second sunday of NEXT YEAR

CONTEXT: My client, a local movie theater, runs a Sunday Matinee Special every other Sunday starting with the SECOND SUNDAY every year. So for this year the dates are 1/11, 1/18, 2/8, 2/22, .... [The only exception is the SUNDAY after their film…
DebraG
  • 9
  • 2
-3
votes
4 answers

mktime function in case of Last day of a month in php

Understanding of last day of a month in the PHP function mktime echo date("Y-m-d H:i:s", mktime(0, 0, 0, 2, 0, 2014)); Output is 2014-01-31 00:00:00 It should be 2014-02-28 00:00:00 Where is the wrong thing I am doing here?
krishna Prasad
  • 3,541
  • 1
  • 34
  • 44
-4
votes
2 answers

mktime returns wrong dates

I'm trying to get a date from a html, and i use mktime to convert it to a day like: Monday $dayisarr=date( "l", mktime(0,0,0, $duedt[1], $duedt[0],$duedt[2] )); when i print it , it returns me a wrong day...like Friday which is wrong.. i tried to…
-5
votes
1 answer

Fatal error: Can't use function return value in write context in your code on line 3 (PHP)

So im having issue with my code. Im trying to implement multiple mktime functions to PHP code using if and else if values but still im getting something wrong. I dont know what could be wrong. I get error PHP check online and i have fixed the code…
JantsoP
  • 1
  • 2
-5
votes
5 answers

Remove hour, minute and second from a date('r")

I have a date with this format : date("r",$dateMktime); In $dateMktime, i only have year, month and day and i'm obliged to use date("r") format. How can i remove hour, minute and seconde ? I don't want to see 00:00:00 when i echo my date. Any idea…
Clément Andraud
  • 9,103
  • 25
  • 80
  • 158
1 2 3
20
21