Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 713
  • Last Modified:

Format Date and Time as yyyy-mm-dd hhmm

I am writing a SPROC.  What is the syntax for converting the result of GetDate() into the format yyyy-mm-dd hhmm?

DECLARE @MyDateTime varchar(20)
@MyDateTime = GetDate()
0
wsturdev
Asked:
wsturdev
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
DECLARE @MyDateTime varchar(20)
SET @MyDateTime = REPLACE(CONVERT(varchar(16), GetDate(), 120), ':', '')
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now