7

The defined date PHP ('w') returns the Sunday function as 7, instead of 0

 3 years ago
source link: https://www.codesd.com/item/the-defined-date-php-w-returns-the-sunday-function-as-7-instead-of-0.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

The defined date PHP ('w') returns the Sunday function as 7, instead of 0

advertisements

From official manual , the date ('w') shows the current date as

0 = Sunday
1 = Monday

.....

6 = Saturday

The problem is , without any further modification , are there any way (eg. set parameter?) to specific the Sunday as 7 instead of 0 ? thanks


Try to use 'N' format specifier for date() function:

date('N')


Description: ISO-8601 numeric representation of the day of the week (added in PHP 5.1.0)

Example returned values: 1 (for Monday) through 7 (for Sunday)

Related Articles

The editing function is INSERT instead of UPDATE CakePHP 2.1

I'm not exactly new to CakePHP though this is my first app in 2.x. I'm using the baked controller & view and am having a problem with the edit function. For starters, here is what was baked: public function edit($id = null) { $this->User->id = $

Replace the OOP code with the only function file (SP instead of OOP)

I'm not Java expert but I'm curious. Suppose that I have this: String StringRepeater(String s, Qty q) { String S = ""; for(int i = 0; i<q;i++) { S +=s; } return S; } boolean MyComp(int a, int b) { return (a<b); } I want to replace the befo

C ++ static member function error The overloaded function C2556 differs only in return type

I want to write a static member function in my class CountInv, which should have only this static function and no other members //Inversions.h #ifndef INV_H #define INV_H #include <string> #include <vector> class CountInv { static void count()

Fatal Error: Undetected Error: calling the mysql_connect () function in C: \ xampp \ htdocs \

I am trying to do a connection with XAMPP and sql server. but when ever I try to enter data or connect to the database, I get this error. Fatal error: Uncaught Error: Call to undefined function mysql_connect() in C:\xampp\htdocs\Maxipak\process.php:3

`return` in a function scala literal

I'm trying to do something like this: var fun : (Int,Int) => Double = (a,b) => { // do something return 1.0 } However, my IDE complaints with Return statement outside method definition. So how do I explicitly give a return statement in a function li

PHP: try to merge array, but not an actual array when the network returns from a function?

I have a function, and it returns an array. class myarray { public function getAr() { // mysql query while($dd= $database->fetch(PDO::FETCH_ASSOC)) { $data[] = $dd; //there's values in the array } return $data; } public function get3() { // mysl quer

PHP json_encode returns the local language characters as html entities. Output required in unicode

My php web service uses json_encode to return json data fetched from MySQL database table. The data should be returned in whatever local language as unicode. Instead local characters like hindi/telugu/bengali are displayed as html entities. But outpu

Php fetch returns the string and not boolean & ldquo; True / false & rdquo; value

I'm using full calender and I have a few events that are all day events. Generally, my php set all 'allDay' => 'false'. Now that I noticed it adds a time on it if I do not specify a time. I want to set all defaults false for all values, unless I spec

What type of data is returned by the following function?

Which type of data is returned by the following function? CFDataRef CreateDatafromImage(UIImage *image) { return CGDataProvidercopyData(CGImageGetDataProvider(image.CGImage)); } Binary image data Raw pixel data Compressed image data ASCII image dataI

The use of PHP JSON returned values ​​to make decisions in jQuery / JavaScript

A friend gave me the following piece of snippet: json : { result: true } success function(data){ if(data.result) { //do something here } else { //do something here } } How would I integrate that code into the following code: $(function() { $("#action

The AJAX redirect after the php message returns true or no error

I have very very little knowledge of javascript but somehow I managed to post form data to a php file. Now I am facing a little problem, there are some validations on php file, what I want is if there is any validation fails and the php file returns

Returning MySQL Table Values ​​from the PHP Script to the Javascript Function - Live Graphics

I have been searching similar problems for hours but with no avail. I am using Highcharts to update a graph every 3 seconds with the last entry of a specific MySQL table. I am using the example Javascript code as a guide. Here is the snippet of code

The AJAX request to the .php file returns the empty string

First: I am new to AJAX and just know some basics about PHP. I want to do an AJAX post to a .php file. To do that I got this code: var lat = results[0].geometry.location.lat(); var lng = results[0].geometry.location.lng(); $.ajax({ url: 'http://api.g

Submit the PHP form and the Jquery function to display the data

I am trying to submit form data in to database, and then retrieve a field from database to calculate the BMI, The INSERT and SELECT query are working fine but the jquery function is on submit and the form, so only the form is submitting and jquery no

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK