Skip to content
Advertisement

Tag: date

php changed database date value

review this piece of code: $values = $mysqli->query(“select * from `my_table`”); while($value = $values->fetch_array()) { print_array($value); } however one column having a date structure …

Using DateTime as a one-liner in PHP

A short and simple question which I couldn’t really find an answer for. In procedural PHP I could echo a date In Object oriented PHP I have to use two lines Is it possible to do this in one line? Answer There are two options: Create a DateTime instance using parenthesis and format the result: You can use the date_create

Detect BST in php

I am building a booking system in php that offers session times for people to book outdoor activities. In the summer months, there is an extra session available at the end of the day, because of Daylight Savings, there is an extra hour in the evenings. I am using this… I only need to show this extra option in the

PHP -> Next nearest date defined by array of days in week

please, really need help with this problem. I have array of offerDays – $offerDays = array(1,6); (mean Monday, and Saturday); For example, input date is Wednesday 2014/09/03. Next available date for offers is Saturday 2014/09/06 Question: How I can in php determine nearest next day? Something like Answer Here you can have a variable array for the offerdays.

php strtotime in seconds and minutes

i use ths method to find the difference between two timestamp and get the number of seconds between those two times, and i refresh the information with jquery like a counter. When the difference is more than 60 seconds, the $time comes back to 0, like a reset. i would like to display 1 min XX s for example Answer

SNMP DateAndTime hex-string convert to human date in PHP

When i want to get the cablemodem event log via SNMP, then i snmpwalk the ‘mib-2.69.1.5.8.1’ oid, but I had the problem because the SNMP store every event date in ‘special’ hex-string called DateAndTime format. (In my case this is a 8 byte hex-string, like this: 07 B2 01 01 00 0A 14 00) I would like to convert to

How to check that day is last day of month in php?

My previous question: how-to-find-current-day-no-in-month-in-php Now I face another problem. Suppose I know that this monday is the 4th monday of the current month. Now how to check that this monday is also the last monday of the current month? Using the code below, I get the name and number of a day: This is the 4th monday of january and

How to find current day no. in month in php

Today’s date is 27-01-2014 so I got day name using following function: So now the day name is mon. How to find that this Monday is the forth Monday of current month? In other words, I am trying to find the 1st, 2nd, 3rd, 4th of a particular day (eg. Monday) of a month? Answer Credit for the Math part

PHP date format /Date(1365004652303-0500)/

I am calling an API from where I am getting date /Date(1365004652303-0500)/, I don’t understand what format this is. How is this date format called? I was not sure what to google for such type of format. Can anyone help me out in getting this date in Y-m-d H:i:s format? The API I am calling is on .NET server. And

Advertisement