Hi ,
I am working at Unix system,using c lang.
I need c fun which return the day of the week .
For example :
0- Sunday.
1- Monday.
....
10x. (4 Replies)
I need o get yesterday's day of week but im not exactly sure. the actual name is what i want. I can do it with numbers but im not sure with words. (3 Replies)
How to find the Day of the Week of the given Date using perl?
If I have a date in YYY--MM-DD format, how to find the DOW? Based on that, I need to find the following sunday.
Pls help. (5 Replies)
Hi All,
I have date in string format 'YYYY-MM-DD'. I want to know day of the week for this date.
Example. For '2005-08-21' my script should return '0' or Sunday
For '2005-08-22' it should return '1' or Monday
I want piece of code for HP-UX korn shell.
Appreciate reply on this. (5 Replies)
Hi all, I am trying to get dow from cal using below script
#! /bin/bash
YEAR=`echo $1 | cut -c 1-4`
MONTH=`echo $1 | cut -c 5-6`
DAY=`echo $1 | cut -c 7-8`
for i in 1 2 3 4 5 6 7
do
dayofweek=`cal $MONTH $YEAR | awk '$i == $DAY {printf("%s","$i")}'`
echo $dayofweek... (4 Replies)
I have been volunteered by my boss to be the sysadmin for our production redhat server. He asked me to tighten the security to avoid mishaps like "rm -f *" that occured not long ago.
Right now, we have 53 users sudo-ing into the machine and it is an audit nightmare. I am wondering if it... (15 Replies)
Hi everyone,
I have a shell script that merges many files down in to one, then removes unwanted lines, that part is working fine:
#!/bin/bash
FILES=/home/pi/temp/qbd/*
for f in $FILES
do
echo "Processing $f file..."
# take action on each file. $f store current file name
echo... (9 Replies)
Hi All,
I have the below requirement ,
if i give the week number for ex 41 i need to get the date for Monday and thursday for this given week. my expected output is 13/10/2014 (Monday's date) and 16/10/2014 (Thursday's date)
I am using GNU LINUX .
Pls help me with your thoughts.
Thanks in... (7 Replies)
Discussion started by: mohanalakshmi
7 Replies
LEARN ABOUT PHP
gmp_setbit
GMP_SETBIT(3) 1 GMP_SETBIT(3)gmp_setbit - Set bitSYNOPSIS
void gmp_setbit (GMP &$a, int $index, [bool $bit_on = true])
DESCRIPTION
Sets bit $index in $a.
PARAMETERS
o $a
- The value to modify. Either a GMP number resource in PHP 5.5 and earlier, a GMP object in PHP 5.6 and later, or a numeric string
provided that it is possible to convert the latter to a number.
o $index
- The index of the bit to set. Index 0 represents the least significant bit.
o $bit_on
- True to set the bit (set it to 1/on); false to clear the bit (set it to 0/off).
RETURN VALUES
A GMP number resource in PHP 5.5 and earlier, or a GMP object in PHP 5.6 and later.
EXAMPLES
Example #1
gmp_setbit(3) example - 0 index
<?php
$a = gmp_init("2"); //
echo gmp_strval($a), ' -> 0b', gmp_strval($a, 2), "
";
gmp_setbit($a, 0); // 0b10 now becomes 0b11
echo gmp_strval($a), ' -> 0b', gmp_strval($a, 2), "
";
?>
The above example will output:
2 -> 0b10
3 -> 0b11
Example #2
gmp_setbit(3) example - 1 index
<?php
$a = gmp_init("0xfd");
echo gmp_strval($a), ' -> 0b', gmp_strval($a, 2), "
";
gmp_setbit($a, 1); // index starts at 0
echo gmp_strval($a), ' -> 0b', gmp_strval($a, 2), "
";
?>
The above example will output:
253 -> 0b11111101
255 -> 0b11111111
Example #3
gmp_setbit(3) example - clearing a bit
<?php
$a = gmp_init("0xff");
echo gmp_strval($a), ' -> 0b', gmp_strval($a, 2), "
";
gmp_setbit($a, 0, false); // clear bit at index 0
echo gmp_strval($a), ' -> 0b', gmp_strval($a, 2), "
";
?>
The above example will output:
255 -> 0b11111111
254 -> 0b11111110
NOTES
Note
Unlike most of the other GMP functions, gmp_setbit(3) must be called with a GMP resource that already exists (using gmp_init(3) for
example). One will not be automatically created.
SEE ALSO gmp_clrbit(3), gmp_testbit(3).
PHP Documentation Group GMP_SETBIT(3)