Date Time Functions

Following is a list of all important Date and Time related functions available through SQL. There are various other functions supported by your RDBMS. Given list is based on MySQL RDBMS.
NameDescription
ADDDATE()Adds dates
ADDTIME()Adds time
CONVERT_TZ()Converts from one timezone to another
CURDATE()Returns the current date
CURRENT_DATE(), CURRENT_DATESynonyms for CURDATE()
CURRENT_TIME(), CURRENT_TIMESynonyms for CURTIME()
CURRENT_TIMESTAMP(), CURRENT_TIMESTAMPSynonyms for NOW()
CURTIME()Returns the current time
DATE_ADD()Adds two dates
DATE_FORMAT()Formats date as specified
DATE_SUB()Subtracts two dates
DATE()Extracts the date part of a date or datetime expression
DATEDIFF()Subtracts two dates
DAY()Synonym for DAYOFMONTH()
DAYNAME()Returns the name of the weekday
DAYOFMONTH()Returns the day of the month (1-31)
DAYOFWEEK()Returns the weekday index of the argument
DAYOFYEAR()Returns the day of the year (1-366)
EXTRACTExtracts part of a date
FROM_DAYS()Converts a day number to a date
FROM_UNIXTIME()Formats date as a UNIX timestamp
HOUR()Extracts the hour
LAST_DAYReturns the last day of the month for the argument
LOCALTIME(), LOCALTIMESynonym for NOW()
LOCALTIMESTAMP, LOCALTIMESTAMP()Synonym for NOW()
MAKEDATE()Creates a date from the year and day of year
MAKETIMEMAKETIME()
MICROSECOND()Returns the microseconds from argument
MINUTE()Returns the minute from the argument
MONTH()Return the month from the date passed
MONTHNAME()Returns the name of the month
NOW()Returns the current date and time
PERIOD_ADD()Adds a period to a year-month
PERIOD_DIFF()Returns the number of months between periods
QUARTER()Returns the quarter from a date argument
SEC_TO_TIME()Converts seconds to 'HH:MM:SS' format
SECOND()Returns the second (0-59)
STR_TO_DATE()Converts a string to a date
SUBDATE()When invoked with three arguments a synonym for DATE_SUB()
SUBTIME()Subtracts times
SYSDATE()Returns the time at which the function executes
TIME_FORMAT()Formats as time
TIME_TO_SEC()Returns the argument converted to seconds
TIME()Extracts the time portion of the expression passed
TIMEDIFF()Subtracts time
TIMESTAMP()With a single argument, this function returns the date or datetime expression. With two arguments, the sum of the arguments
TIMESTAMPADD()Adds an interval to a datetime expression
TIMESTAMPDIFF()Subtracts an interval from a datetime expression
TO_DAYS()Returns the date argument converted to days
UNIX_TIMESTAMP()Returns a UNIX timestamp
UTC_DATE()Returns the current UTC date
UTC_TIME()Returns the current UTC time
UTC_TIMESTAMP()Returns the current UTC date and time
WEEK()Returns the week number
WEEKDAY()Returns the weekday index
WEEKOFYEAR()Returns the calendar week of the date (1-53)
YEAR()Returns the year
YEARWEEK()Returns the year and week
















Codigniter Interview Questions & Answers

1) Explain what is CodeIgniter?

Codeigniter is an open source framework for web application. It is used to develop websites on PHP. It is loosely based on MVC pattern, and it is easy to use compare to other PHP framework.

2) Explain what are hooks in CodeIgniter?

Codeigniter’s hooks feature provides a way to change the inner working of the framework without hacking the core files. In other word, hooks allow you to execute a script with a particular path within the Codeigniter.  Usually, it is defined in application/config/hooks.php file.

3) Explain how you will load or add a model in CodeIgniter?

Within your controller functions, models will typically be loaded; you will use the function

$this->load->model (‘Model_Name’);

4) Explain what helpers in CodeIgniter are and how you can load a helper file?

In CodeIgniter, helpers are group of function in a particular category that assist you to perform specific functions. In CodeIgniter, you will find many helpers like URL helpers- helping in creating links, Text helpers- perform various text formatting routines, Cookies- helpers set and read cookies.  You can load helper file by using command $this->load->helper (‘name’) ;

5) Explain routing in Codeigniter?

In CodeIgniter, the way PHP files served is different rather than accessing it directly from the browser. This process is called routing. Routing in CodeIgniter gives you freedom to customize the default URL pattern to use our own URL pattern according to the requirement. So, whenever there is a request made and matches our URL pattern it will automatically direct to the specified controller and  function.

codeigniter

6) Why is there a need to configure the URL routes?

Changing the URL routes has some benefits like

From SEO point of view, to make URL SEO friendly and get more user visits
Hide some URL element such as a function name, controller name, etc. from the users for security reasons
Provide different functionality to particular parts of a system

7) List out different types of hook point in Codeigniter?

Different types of hook point in Codeigniter includes

post_controller_constructor
pre_controller
post_sytem
pre_system
cache_override
display_override
post_controller

8) Mention what are the security parameter for XSS in CodeIgniter?

Codeigniter has got a cross-site scripting hack prevention filter. This filter either runs automatically or you can run it as per item basis, to filter all POST and COOKIE data that come across.  The XSS filter will target the commonly used methods to trigger JavaScript or other types of code that attempt to hijack cookies or other malicious activity. If it detects any suspicious thing or anything disallowed is encountered, it will convert the data to character entities.

9) Explain how you can link images/CSS/JavaScript from a view in code igniter?

In HTML, there is no Codeigniter way, as such it is a PHP server side framework. Just use an absolute path to your resources to link images/CSS/JavaScript from a view in CodeIgniter

/css/styles.css

/js/query.php

/img/news/566.gpg

10) Explain what is inhibitor in CodeIgniter?

For CodeIgniter, inhibitor is an error handler class, using the native PHP functions like set_exception_handler, set_error_handler, register_shutdown_function to handle parse errors, exceptions, and fatal errors.

11) Mention what is the default URL pattern used in Codeigniter framework?

Codeigniter framework URL has four main components in default URL pattern.  First we have the server name and next we have the controller class name followed by controller function name and function parameters at the end. Codeigniter can be accessed using the URL helper. For example http://servername/controllerName/controllerFunction/parameter1/parameter2.

12) Explain how you can extend the class in Codeigniter?

To extend the native input class in CodeIgniter, you have to build a file named application/core/MY_Input.php and declare your class with

Class MY_Input extends CI_Input {

}

13) Explain how you can prevent CodeIgniter from CSRF?

There are several ways to protect CodeIgniter from CSRF, one way of doing is to use a hidden field in each form on the website.  This hidden field is referred as CSRF token; it is nothing but a random value that alters with each HTTP request sent. As soon as it is inserted in the website forms, it gets saved in the user’s session as well.  So, when the form is submitted by the users, the website checks whether it is the same as the one saved in the session. If it is same then, the request is legitimate.

14) Explain how you can enable CSRF (Cross Site Request Forgery) in CodeIgniter?

You can activate CSRF (Cross Site Request Forgery) protection in CodeIgniter by operating your application/config/config.php file and setting it to

$config [ ‘csrf_protection’] = TRUE;

If you avail the form helper, the form_open() function will insert a hidden csrf field in your forms automatically

Brands Abbreviation

1) adidas : " All Day I Dream About Sports " 
2) yahoo : yet another Hierarchical official oracle 
3) puma : Person Underestimating Me is an Animal 
4)icici bank : Earlier it was "Industrial Credit and Investment Corporation of India". 
Now it is has no full form and it is simply ICICI Bank as a private entity and a private bank 
5) hdfc bank :HDFC Bank Ltd. itself is the full name of the bank. 
The bank was promoted by HDFC a housing finance institution in the year 1994. Full name of HDFC is Housing Development Finance Corporation Ltd. 


1. BMW

BMW means Bayerische Motoren Werke, which translates to "Bavarian Motor Works."
*

2. L.L. Bean

The company was founded by Leon Leonwood Bean.
*

3. CVS

CVS originally stood for Consumer Value Stores. Over time the name became simply CVS.
*

4. YKK

Those letters on seemingly every zipper stand for Yoshida K?gy? Kabushikigaisha, which translates to "Yoshida Manufacturing Corporation."
*

5. A&W

The A and W of A&W are (Roy) Allen and (Frank) Wright.
*

6. M&M's

M&M’s stands for Mars & Murrie’s, the last names of the candy’s founders. Matt Soniak recently wrote about Forrest Mars, Sr. and Bruce Murrie's famous partnership.
*

7. 3M

3M is a shorter, snazzier way to say Minnesota Mining and Manufacturing.
*

8. HSBC

HSBC stands for Hongkong and Shanghai Banking Corporation.
*

9. TCBY

You probably know TCBY means The Country's Best Yogurt, but it didn't always. TCBY was "This Can't Be Yogurt" until they were sued by I Can't Believe It's Yogurt!, a rival frozen yogurt chain.
*

10. Kmart

Kresge is the K in Kmart, for founder Sebastian S. Kresge.
*

11. DSW Shoes

DSW is short for Designer Shoe Warehouse, which makes DSW Shoes the ATM machine and PIN number of the retail footwear game.
*

12. JCPenney

James Cash Penney.
*

13. CBS

Columbia Broadcasting System. (Earlier this year, Erica Hill, Charlie Rose and Gayle King started working mental_floss facts into CBS This Morning. Love seeing the facts on TV!)
*

14. TASER

TASER stands for Thomas A. Swift's Electric Rifle. (Nobody has whipped out a TASER around me of late, so I broke down and used a screenshot.)
*

15. smart car

A collaboration between Swatch and Mercedes, smart car is short for Swatch Mercedes Art (car).
*

16. ZIP Code

ZIP = Zone Improvement Plan. Smokey The Bear has his own ZIP Code. In case you want to fire off a fan letter, it's 20252.
*

17. USA PATRIOT Act

That's the "Uniting and Strengthening America by Providing Appropriate Tools Required to Intercept and Obstruct Terrorism" Act to you. Back to the photos...
*

18. P.G. Wodehouse

Sir Pelham Grenville Wodehouse.
*

19. A.A. Milne

Alan Alexander Milne.
*

20. E.B. White

Elwyn Brooks White.
*

21. P.D. Eastman

Philip Dey Eastman.
*

22. Hunter S. Thompson

Hunter Stockton Thompson.
*

23. J.R.R. Tolkien

John Ronald Reuel Tolkien.
*

24. CC Sabathia

Carsten Charles Sabathia.
*

25. Michael J. Fox

Michael J. Fox's middle name is Andrew.
*

26. NECCO

New England Confectionery COmpany.
*

27. F.A.O. Schwarz

Frederick August Otto Schwarz founded the toy company with his brothers.
*

28. DHL

DHL = (Adrian) Dalsey, (Larry) Hillblom and (Robert) Lynn.
*

29. Chuck E. Cheese's

Chuck E. Cheese's middle name is Entertainment. (I believe reader Trivia Wayne told us that one.)
*

30. ALF

Gordon Shumway's nickname is an acronym for Alien Life Form.
*

31. Rutherford B. Hayes

That B stands for Birchard. While we're talking presidential middle names, don't forget James Knox Polk, James Abram Garfield, Chester Alan Arthur, Warren Gamaliel Harding, and Richard Milhous Nixon

Featured post

A23 Rummy - Safe Secure Gaming Platform

A23 Rummy is a popular online rummy platform in India. It is owned and operated by Head Digital Works Private Limited. The platform offers...