Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Military Time

2 posts in Windows NT Last posting was on 1998-02-13 21:03:53.0Z
Walter Espinales Posted on 1998-02-13 20:23:43.0Z
From: "Walter Espinales" <wespinal@inch.com>
Subject: Military Time
Date: Fri, 13 Feb 1998 15:23:43 -0500
Lines: 17
X-Newsreader: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Message-ID: <Zd7gzQLO9GA.205@forums.powersoft.com>
Newsgroups: sybase.public.sqlserver.nt
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.sqlserver.nt:5193
Article PK: 1081274

Hi Everyone,

I'm currently migrating a MSQL server database to Adaptive Server. Many
of the current store procedures need to interrogate the current system date,
but in military format. The following select is an example:

select UKTime = convert(varchar, getdate(),113)

UKTime
------------------------------
13 Feb 1998 15:14:26:413

The 113 at the end of the statement indicates the convertion format to
use. Is there in sybase a counterpart to this conversion format.


Bret Halford Posted on 1998-02-13 21:03:53.0Z
Message-ID: <34E4B539.9BE@sybase.com>
Date: Fri, 13 Feb 1998 14:03:53 -0700
From: Bret Halford <bret@sybase.com>
Organization: Customer Service & Support
X-Mailer: Mozilla 3.0 (X11; U; SunOS 5.5.1 sun4m)
MIME-Version: 1.0
To: Walter Espinales <wespinal@inch.com>
Subject: Re: Military Time
References: <Zd7gzQLO9GA.205@forums.powersoft.com>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Newsgroups: sybase.public.sqlserver.nt
Lines: 36
Path: forums-1-dub!forums-master.sybase.com!forums.powersoft.com
Xref: forums-1-dub sybase.public.sqlserver.nt:5192
Article PK: 1081272


Walter Espinales wrote:
>
> Hi Everyone,
>
> I'm currently migrating a MSQL server database to Adaptive Server. Many
> of the current store procedures need to interrogate the current system date,
> but in military format. The following select is an example:
>
> select UKTime = convert(varchar, getdate(),113)
>
> UKTime
> ------------------------------
> 13 Feb 1998 15:14:26:413
>
> The 113 at the end of the statement indicates the convertion format to
> use. Is there in sybase a counterpart to this conversion format.

Not directly, but you can build it up from the existing functions
(note that it will take a bit more work to zero-pad the milliseconds,
example code for zero-padding can be found at
http://reality.sgi.com/pablo/Sybase_FAQ).

1> declare @x datetime
select @x = getdate()
select UKTime = convert(varchar,convert(varchar,@x,106) + " "
+convert(varchar,@x,8)
+ ":" + convert(varchar,datepart(mm,@x)))

go
2> 3> 4> 5> 6> 7> 8> (1 row affected)
UKTime
------------------------------
13 Feb 1998 21:02:05:2

(1 row affected)



--
Bret Halford Imagine my disappointment
Sybase Technical Support in learning the true nature
3665 Discovery Drive of rec.humor.oracle...
Boulder, CO 80303