Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

get today date format dd/mm/yyyy sql visual.net

Posted on 2013-01-07
11
Medium Priority
?
445 Views
Last Modified: 2013-01-07
Hi, all
is any way to achive

Dim nusa1 As String = "update cheque set fechat=today format (dd/mm/yyyy) where id='" & CustomerId & "'"
            Dim cmd11 As New OleDbCommand(nusa1, cn)
            cmd11.ExecuteScalar()

I need retrive the today date format dd/mm/yyyy
tsm
0
Comment
Question by:Ernesto
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
  • 2
  • +1
11 Comments
 
LVL 8

Expert Comment

by:Crashman
ID: 38751303
for sql

DECLARE  @dt DATETIME
set @dt = '2013-01-01'
select CONVERT(VARCHAR,@dt, 103) 

Open in new window


for basic

http://msdn.microsoft.com/en-us/library/az4se3k1%28v=vs.71%29.aspx
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
0
 

Author Comment

by:Ernesto
ID: 38751314
i need it to put in  vb.net code
tsm
0
 
LVL 18

Expert Comment

by:deighton
ID: 38751331
what is the data type of field fechat?

Are you wanting to retrieve data from the table or update the table?

The code you showed us updates the table.  I believe there is no select so it retrieves no data.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:Ernesto
ID: 38751341
is varchar
tsm
update the table with the todays date

yes it update the table
0
 

Author Comment

by:Ernesto
ID: 38751357
but i need to update with the system date  
tsm
0
 
LVL 8

Expert Comment

by:Crashman
ID: 38751386
save in a variable,

Dim dtNow as Datetime
Dim nusa1 As String = "update cheque set fechat= getdate() where id='" & CustomerId & "'"
Dim cmd11 As New OleDbCommand(nusa1, cn)
dtNow = Cast(cmd11.ExecuteScalar() as datetime)
' later format you datetime value
dim strFormat as string 
strFormat = Format(dtNow,"dd/MM/yy")

Open in new window

0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 38751461
Change this

Dim nusa1 As String = "update cheque set fechat=today format (dd/mm/yyyy) where id='" & CustomerId & "'"

to

Dim nusa1 As String = "update cheque set fechat='" & Today.ToString("dd/mm/yyyy") & "' where id='" & CustomerId & "'"
0
 

Author Comment

by:Ernesto
ID: 38751496
codecruise
almost
give me the date as 07/00/2013
when need to be  07/01/2013

tsm
almos please!!!
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 38751513
oops. use

Dim nusa1 As String = "update cheque set fechat='" & Today.ToString("dd/MM/yyyy") & "' where id='" & CustomerId & "'"
0
 

Author Comment

by:Ernesto
ID: 38751514
ok need to be  ("dd/MM/yyyy")
tsm
regards,
you save me!!
0
 

Author Closing Comment

by:Ernesto
ID: 38751518
tsm all
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question