Datetime conversion in Sybase - sap-iq

I am new to sybase and trying to convert YYYY-MM-DDTHH24:MI:SS to YYYY-MM-DD in sybase?
I tried using Convert function but it does not work because of T in the datetime format.
Is there a option to achieve this using convert function?

Related

How can I convert date in unix epoch format to ruby datetime for a datetime column

The date is coming from an imported xml that gives a 13 digit string (unix epoch time format).
The following snippet causes the resulting column value to be set to 1970-01-01
seconds=msg.time_stamp_long.to_i/1000
time=Time.at(seconds).utc.to_s
msg.time_stamp=time
msg.save
How to get the correct format for a DateTime column?
Time.at(1663681609392 / 1000).to_datetime
or if it's a string
Time.at("1663681609392".to_i / 1000).to_datetime
Be aware that unix time is epoch UTC time. Time and DateTime can get tricky in Ruby and in Rails. Make sure you are getting the time you expect. You may need to look into methods like .in_time_zone
To use your variables from the question:
msg.update(time_stamp: Time.at(msg.time_stamp_long / 1000))
is all you really need. As Max pointed out the DB adapter will handle the rest. But when you go to display or manipulate dates/times in Rails you might want to look into Date, Time, TimeWithZone, DateTime, etc. to understand the options that are out there and how they apply to your use case.

FME change data format from string to numeric

Struggling with a really simple problem; I need to convert attribute from string to numeric in FME. have tried using the arithmetic editor, but every time I export to GIS I get string. It seems when one uses the statistics calculator you get numeric.
Any ideas? As I am all out of them.
Ashton

Converting Date Format in Advantage SQL

I have a simple problem in Advantage Database SQL.
I have dates in the format M/D/YYYY and want to convert them MM/DD/YYYY. Normally in SQL Server I would just use a convert(varchar(20), field, 101) but this does not work in Advantage.
What is the format for doing so?
I don't believe there is a simple conversion function like that available. To convert it directly in SQL would probably turn into a fairly messy statement (I think it would require a combination of CONVERT, YEAR, DAY, and MONTH scalars).
If the goal, though, is to force the display of date values in a specific format in the client application, then one possibility might be to specify the date format at connection time. How you do that depends on the client being used. If, for example, you are using a connection string, then you may be able to specify the date format as follows.
Data Source=\\server\share\yourdatapath;...;DateFormat=MM/DD/YYYY;

FileHelpers CSV timespan

I'm parsing a CSV with the fileHelpers module in F#. Was wondering what the best approach to converting a time to the best format. I assumed the best format would be a timeSpan, however can't find a convertKind for the timespan
if i had a string e.g. 10:05.0
This would represent 10:05 am. What would be the best way to use ConvertKind with the FileHelpers Library to parse this string into a structure that represented 10:05
thanks for all the help!
You could implement your conversion in a custom Converter (inherit ConverterBase), then use it in your FieldConverter attribute

implicit conversion of Object to XML in flex 3

when I send an object through an HTTPService to an XML api run by a Rest ruby on rails server.. how does it get converted to XML? I mean, it just works fine for strings and numbers, but for example Date type conversion causes an "unprocessable entity" error on rails log..
Any Idea?
One possibility is that when the object is converted to XML, Flash calls toString() on the Date object, resulting in the Day Mon DD HH:MM:SS TZD YYYY format. If you call valueOf() on the Date object, you will get milliseconds since epoch, which is probably better for your case.
How to convert as3 objects to xml
http://blog.flexexamples.com/2008/03/04/converting-objects-to-xml-packets-using-the-simplexmlencoder-class-in-flex/

Resources