473,405 Members | 2,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Convert TimeStamp

Banging my head on this and it is probably simple....

What is the cleanest way to get today's timestamp in a character string
of 14 without seperators YYYYMMDDHHMMSS?

Ie : 2006-02-28-10.53.37.230256
as
20060228105337

I know I can use SUBSTR but seems like a cludge...

Chris

Feb 28 '06 #1
3 11250
Instead of SUBSTR you could use YEAR(), MONTH(), etc...

Or: REPLACE(TRANSLATE(CHAR(CURRENT TIMESTAMP), '', '.-'), ' ', '')

B.

Feb 28 '06 #2
Hmm, didn't work for me. Errored on TRANSLATE. Maybe I messed up the
quotes. However, you did give me an Idea. Hence, this works:

Substr(
REPLACE(REPLACE( CHAR(CURRENT TIMESTAMP), '-', ''), '.','')
,1,14)

Chris

Feb 28 '06 #3
Ian
Chris wrote:
Banging my head on this and it is probably simple....

What is the cleanest way to get today's timestamp in a character string
of 14 without seperators YYYYMMDDHHMMSS?

Ie : 2006-02-28-10.53.37.230256
as
20060228105337


cast(bigint(your_timestamp) as char(14))
Mar 9 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
1
by: Manzoorul Hassan | last post by:
I need to convert a date / time to NTP Timestamp, in HEX no less, and was wondering if there might be a module for it. Any ideas? I have been searching for NTP Timestamp under Perl but have not...
8
by: Chris | last post by:
Sorry, This should be simple, but brain is hurting... How do I convert a Current Time to a Decimal 6,0 (HMS)? There must be a cleaner way then this: Insert into Table Values Dec(...
4
by: Dean Slindee | last post by:
I have a timestamp field that I would like to display in a textbox. The timestamp is an 8 byte array. Can this be converted to a string in one statement or does it require cycling thru one byte...
10
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these...
5
by: whitsey | last post by:
Hi, I can easily convert a TIMESTAMP to a DATE which will give me results in the format 'DD/MM/YYYY' however, what I want to do is convert the TIMESTAMP to just 'MM/YYYY' or even better...
1
by: sebasC | last post by:
the code below is used on a site to show time in multiple time zones on the website what i need is to convert the php code below to asp so that it will work. because the clock shows on the site but...
4
by: skulkrinbait | last post by:
Hello How can I convert a date into the Unix timestamp? I don't really mind what format the date is in, something like MMDDYY would be fine, can someone show me what code I would need to do...
3
by: yogi | last post by:
Hi, I am working on a database that has a variable with timestamp values. I wanted to convert the variable from timestamp to yyyy-mm-dd format. Thanks in advance Yogi
4
by: Tim Kelley | last post by:
Is it possible to store a sql2000 timestamp field to a variable in C#. I am creating a dataset from a stored procedure and one of the fields is a timestamp field. I have created a variable of...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.