Inception

A world beyond boundaries, my world

How to get Current Date and Time in SQL

with one comment

Ever wondered that how can I get the current Date and Time in SQL, just the way we dot in VB.Net using Date.now. Well it is more simple than you thought

Use T-SQL command CURRENT_TIMESTAMP

This will return the current date and time value without the database time zone offset.

How do i use it? It’s very simple……

Select CURRENT_TIMESTAMP (returns the current date and time)

Update table1 set ddate = CURRENT_TIMESTAMP (updates table1 and sets value of field ddate to current date and time)

Hope you find this article useful…. :)

 

 

Written by Zaheed

October 27, 2009 at 10:43 am

Posted in SQL

Tagged with , , , ,

One Response

Subscribe to comments with RSS.

  1. Hey this post was really very helpful!!!!

    Jabir

    October 27, 2009 at 10:51 am


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.