Is it possible to convert a string (eg. 2140) into time in flex?
Hi.
I have a form where the user inputs the time into a text input...I want to take that and convert it to time/date...is that possible?
Hi,
Did you mean convert "2140" to "21:40"? You can write your own parser/formatter, that takes the string, analyzes it, and puts a colon ":" in appropriate place. Or alternatively you can check this post http://scottrbailey.wordpress.com/2009/05/28/parsing-dates-flex-as3/ . Try the parseTime function, it seems to do exactly what you want.
Regards,
Adrian Wiecek
Similar Messages
-
Converting a string of numbers into an array of booleans
For a homework assignment, I need to convert a string of numbers into an array of booleans. The string is a bunch of random numbers (0-9) in sequence, with no spaces. It looks something like this: 0123452348949230740329817438120947392147809231419. I need to make it so that each even number represents a "True" boolean and so that each odd number represents a "False" boolean. I think that I first need to convert each element of the string into a number, and then use a case structure (or something) to say, for each element of the array, "If even, then true. If odd, then false," but I could be wrong. Any suggestions?
billko wrote:
Hooovahh wrote:
billko wrote:
Sounds reasonable. Think about the definition of "odd" and "even" and it will make life a lot easier.
I know you are trying to be vague but I'd like to give a key hint. Use the Quotient and Remainder function.
LOL maybe that was one of the objectives of the homework.
To be fair it sounds like there is more work that is needed. A new user of LabVIEW will have a hard time figuring out how to process each character one at a time when it isn't in an array.
It's just that most people (me at least) stopped thinking about division with quotient and remainder after basic algebra. I then of course changed my way of thinking when I used LabVIEW. Still most of the time when you use division you want to know the fractional part as a decimal. Thinking this way makes the problem more difficult then it needs to be.
Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously. -
Is it possible to convert from string to variant?
Hi!
I would like to convert a text string to variant. I'm doing this because I would like to merge a couple of signals and then save all the signals in a lvm-file. Could someone please explain how to convert from text to variant, is it possible?
Thanks in advance!
Regards,
Mattias
Attachments:
Merge signals.JPG 27 KBWhat you are attempting to do is possible, but might not give you the results you expect. All you need to do is convert your string to an array of U8s using the String to Byte Array conversion primitive. In the file, you will get a single character per line of the file expressed as the ASCII code. When you read it, convert to U8s, then use Byte Array to String to get your string back.
You may also want to read up on LVM files. There are several places to put strings that work a little better than this.
This account is no longer active. Contact ShadesOfGray for current posts and information. -
Problem in converting the String to Date with time zone GMT
Hi,
When I tried to convert the string 12/05/2009 to Date, the time zone is set to BST.On the other hand, for the date 12/12/2009, the time zone is set to GMT. What should I do to get the time zone as GMT all the time.?
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
String dateString = "12/05/2009";
System.out.println(myDate.toString());I think you are all missing the point. java.util.Date objects always alway always store the date as the number of milliseconds since 1/1/1970 UTC so the only TimeZone they have its the implicit UTC. When you use the Date.toString() method the toString() method gets the default time zone from your environment and formats the data accordingly. This means that the same Date object will, by default, produce a different result for France and Australia and the US.
So, if you have the date "12/5/2009" as a String then to convert it to a java.util.Date you must specify what TimeZone is implied. If it is your system time zone then you can just create a SimpleDateFormat object with the correct format and then use the parse() method to create the java.util.Date object and this will automatically be converted to UTC. If the date String represents some other time zone then you must explicitly set the time zone of the SimpleDateFormat object before parsing the string.
The same approach applies when converting a java.util.Date object to a String. If you want anything other than your system time zone then you must explicitly tell the SimpleDateFormat what time zone you want the result formatted for. -
Unicode: Is it Possible to convert a string, or text, for Output?
Can you take a string (or text) in Unicode (4 bytes each character), and by using its string (or text), as input it to a Function Module, or Method, have the string's hex values converted into the old non-unicode value (2 bytes each character) to send to an external system?
I wish it were this easy, but am finding out it is not. Seems like whenever I run a process to convert a field (4 bytes) in the new unicode system, to old non-unicode (2 bytes each), and move it back into a field in the unicode system, it automatically converts it back to 4 bytes automatically?
It is causing issues on the external tergat system that is not using unicode.
Thank-You.Not that I know of. But you could convert your text to RAW or XSTRING, and send that value to the external system.
Jan -
I need help to convert a string to date and time
Good aft,
1.How can i get a date from the user input thro' Frames?
2.How to parse it to the date object(I need to include java.util.Date but for the database i need to include java.sql.*,if i do so, i have error as
found:java.util.Date
Required:java.sql.Date)
3.How to insert into the database
The same i need help to insert time into database?
I need solution and explanation...
Reply me immediately...
If u send me the code, its better to me.Hello,
The best way is to use the HEX to decimal coversion VI in the string pallette. Then, write this decimal directly to your chart. If you are doing it a point at a time put it into a while loop.
Doug -
Is it possible to convert a table of values into a comma-delimited-list?
Hi,
I'd like to turn the following dataset:
Parent | Child
Charles | William
Charles | Harry
Anne | Peter
Anne | Zara
Andrew | Beatrice
Andrew | Eugenie
into this:
Parent | Children
Charles | Diana,Camilla
Anne | Peter,Zara
Andrew | Beatrice,Eugenie
In other words, I'd like to take a list of values pertaining to some key and produce them as a comma-delimited-list.
I know its is possible in T-SQL although the method is a bit of a nasty hack. Is it possible in PL-SQL?
Thaks in advance
JamieHi,
With model clause (10g)
with t as(
select 'Charles' parent, 'William' child from dual union
select 'Charles', 'Harry' from dual union
select 'Anne', 'Peter' from dual union
select 'Anne', 'Zara' from dual union
select 'Andrew', 'Beatrice' from dual union
select 'Andrew', 'Eugenie' from dual
select parent,substr(res,2) res
from t
model
return updated rows
partition by ( parent)
dimension by ( row_number()over(partition by parent order by child) rn)
measures(child, cast( null as varchar2(4000)) as res)
rules
iterate(100000)
until(presentv(res[iteration_number+2],1,0)=0)
( res[0]=res[0]||','||child[iteration_number+1]);
PARENT RES
Anne Peter,Zara
Andrew Beatrice,Eugenie
Charles Harry,William
3 rows selected. -
Convert the string-encoded uid into its original object form
I have written the uid string into a database and when I need it again in my code I need to rebuild the UID from the string in the db, as it was before.
Does somebody know how this can be done with java?
Thx in advanceI have written the uid string into a database and when I need it again in my code I need to rebuild the UID from the string in the db, as it was before.
Does somebody know how this can be done with java?
Thx in advance -
Single string tag expanded into 100 plc register values
I found a way to read 100 registers of plc data with a single string tag, if you can guarantee that none of the plc registers are zero. A register value of zero acts like a Null ascii terminator and truncates the string. Define the string tag as 200 bytes and uncheck the text data only box. Use the code in the attached picture to convert the string bytes back into decimal register values.
Attachments:
string tag to 100 U16 values.gif 2 KBIns't that code exactly the same as typecasting to an U16 Array?
Message Edited by altenbach on 05-19-2005 07:24 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
CastingU16.gif 3 KB -
It is possible to convert String to XMLDocument?
I use XML SQL Utility to generate an XML document from the results of a query. I want to apply XSLT on this xml document.
The problem is that XSU generates the document in String format. Or I use XSLProcessor.processXSL, and this method needs to parameters stylesheet and XMLDocument.
So, my question is :It is possible to convert String to XMLDocument?
Thanks.<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by Steven Muench ([email protected]):
Use getXMLDOM() instead of getXMLString() on the OracleXMLQuery object. This returns you a DOM representation instead of a string, avoiding parsing.<HR></BLOCKQUOTE>
Hi
I'm reading about how " generate an XML document from the results of a query" i exactly want to do this but i need to create the XML file not only generate it. How I "create" the XML file?. Because, I need to manipulate later my XML file.
Thanks for any help.
null -
Hi All,
Can you please let me know for any sample code in xslt/java mapping for converting XML string into XML. We use SAP Pi 7.0
My XML string starts like this
<?xml version="1.0" encoding="UTF-8" ?>
- <ns0:MT_ReceiverFileStructure <namespace>"><Output><?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<xsl>"?><Tarih_Date Tarih="11.09.2014" Date="09/11/2014>
Thanks,
PavithraThanks Praveen. It worked.
However, the xml i have is an extract from a exchange rate URL and it has the reference to a xsl in it as below
<?xml version="1.0" encoding="ISO-8859-9"?><?xml-stylesheet type="text/xsl" href="<ABC.xsl>"?>.
So there is an error in sxmb_moni. Is it possible to remove this. -
Its possible to convert Apple script to Java script
Hi,
Please Help me anyone to do that script.
its possible to convert below mentioned Apple script to Java Script.
Thanks in advance.
Help me......!
-yajiv
Code:
tell me to addImageLabels()
on addImageLabels()
tell application "Adobe InDesign CS5"
set numberAdded to 0
activate
set enable redraw of script preferences to true
set currentFonts to (get name of every font)
if currentFonts does not contain fontname then
display dialog "The font \"" & fontname & "\" is not active on your system." buttons {"Continue anyway", "Cancel"} default button 2
end if
tell document 1
-- get a list of unique page IDs in this document
set allpageids to my getPageIds()
repeat with p from 1 to (length of allpageids)
set pgid to item p of allpageids
-- loop through these, getting a list of unique page item IDs to inspect
tell page id pgid
set pageitems to (get id of every page item)
repeat with i from 1 to (length of pageitems)
set pid to item i of pageitems
tell page item id pid
try
-- certain boxes will fail to yield a content type, whatever
if content type is graphic type then
set c to class
set i to id
-- get the name of the link, i.e. the filename, subject to labelFormat (full name, first six chars, etc.)
set gn to my getImageName(pgid, c, i)
if (gn is not "Empty") and (gn is not "") then
set b to visible bounds
set h to (item 3 of b) - (item 1 of b)
set newtop to (item 1 of b) + (h / 2)
set item 1 of b to newtop
set w to (item 4 of b) - (item 2 of b)
if w < minwidth then
set item 4 of b to ((item 4 of b) + 0.2)
set item 2 of b to ((item 2 of b) - 0.2)
end if
set l to (make new text frame at beginning of page id pgid with properties {visible bounds:b, fill color:fillcolor, contents:gn, label:"imagelabel"})
tell l
tell paragraph 1
set justification to center align
try
set applied font to fontname
end try
set point size to fontsize
set fill color to textcolor
end tell
set inset spacing of text frame preferences to ((insetspacing as string) & " in") as string
fit given frame to content
set numberAdded to numberAdded + 1
end tell
end if
end if
end try
end tell
end repeat
end tell
end repeat -- allpageids
end tell -- document 1
display dialog "Added " & numberAdded & " labels." buttons {okButton} default button 1 giving up after 10 with title scriptName
end tell -- InDesign
end addImageLabels
on getPageIds()
tell application "Adobe InDesign CS5"
tell document 1
tell master spread 1
set masterpageids to (get id of every page)
end tell
set docpageids to (get id of every page)
end tell
end tell
return masterpageids & docpageids
end getPageIds
on getImageName(int1, cla1, int2)
tell application "Adobe InDesign CS5"
tell document 1
tell page id int1
if cla1 is rectangle then
set imagename to (name of item link of graphic 1 of rectangle id int2)
else if cla1 is polygon then
set imagename to (name of item link of graphic 1 of polygon id int2)
else
return "Unknown"
end if
try
if (labelformat is "First six characters") then
return (characters 1 thru 6 of imagename) as string
else if (labelformat is "Base name of linked file") then
set op to offset of "." in imagename
return (characters 1 thru (op - 1)) of imagename as string
else
return imagename
end if
on error
return "Empty"
end try
end tell
end tell
end tell
end getImageNameYajiv:
I realize English is probably not your first language, but you are not really making sense. Perhaps you could use more words and write in more detail.
It seems you already have your script in AppleScript. Why do you need to convert it to JavaScript?
It's going to be inconvenient at best and probably not worth anyone's time.
Just use the AppleScript. -
Converting a String to an integer?
i need to convert a string to an integer..i searched through the site but i didn't find anything...
Is this conversion possible?You didn't look very hard - it's right in the javadocs:
String s = "44";
int x = Integer.parseInt(s);I'll leave the exception handling for you. -
Hi,
I have a problem with an PropertyGrid enum property that uses a type converter.
In general it works, but when I double clicking or using the scoll wheel, an error message appears:
"Property value is not valid"
Details: "Object of type 'System.String' cannot be converted to type 'myCompany.myProject.CC_myCustomProperty."
I noticed that the CommitValue method (in PropertyGridView.cs) tries to convert a string value to a CC_myCustomProperty object.
Here is the code that causes the error (see line 33):
(Using the .net symbols from the PropertyGridView.cs file)
1
internal bool CommitValue(GridEntry ipeCur, object value) {
2
3
Debug.WriteLineIf(CompModSwitches.DebugGridView.TraceVerbose, "PropertyGridView:CommitValue(" + (value==null ? "null" :value.ToString()) + ")");
4
5
int propCount = ipeCur.ChildCount;
6
bool capture = Edit.HookMouseDown;
7
object originalValue = null;
8
9
try {
10
originalValue = ipeCur.PropertyValue;
11
12
catch {
13
// if the getter is failing, we still want to let
14
// the set happen.
15
16
17
try {
18
try {
19
SetFlag(FlagInPropertySet, true);
20
21
//if this propentry is enumerable, then once a value is selected from the editor,
22
//we'll want to close the drop down (like true/false). Otherwise, if we're
23
//working with Anchor for ex., then we should be able to select different values
24
//from the editor, without having it close every time.
25
if (ipeCur != null &&
26
ipeCur.Enumerable) {
27
CloseDropDown();
28
29
30
try {
31
Edit.DisableMouseHook = true;
32
/*** This Step fails because the commit method is trying to convert a string to myCustom objet ***/
33
ipeCur.PropertyValue = value;
34
35
finally {
36
Edit.DisableMouseHook = false;
37
Edit.HookMouseDown = capture;
38
39
40
catch (Exception ex) {
41
SetCommitError(ERROR_THROWN);
42
ShowInvalidMessage(ipeCur.PropertyLabel, value, ex);
43
return false;
44
I'm stuck.
I was wondering is there a way to work around this? Maybe extend the string converter class to accept this?
Thanks in advance,
Eric
Hi,
Thank you for your post! I would suggest posting your question in one of the MS Forums,
MSDN Forums » Windows Forms » Windows Forms General
located here:http://forums.microsoft.com/MSDN/ShowForum.aspx?ForumID=8&SiteID=1.
Have a great day! -
Is it possible to convert an app from 12c to 11g?
I am using both 11.1.2.4 and 12.1.2.0.
If I have an app built with 12.1.2.0, which does not include any 12c specific features, is it possible to convert it to 11.1.2.4?
I am asking because I have a Development environment that is 12c, but a Production environment that is 11g and I am not sure we will be able to upgrade the Production environment
Thanks in advance..It's possible but not an easy task. As 12c uses newer stuff you have to test everything with great care. You might find some things you have to rebuild add they won't work in 11.1.2.4.0 (e.g. components which are only available in 12c. If you read the what's new doc for 12c and you find something you have used, prepare to rebuild this part.
First thing to try ids to open the project in 11.1.2.4.0 and see if you can compile and run the app.
Timo
Maybe you are looking for
-
Computer Freezes - Finder (not responding)
So I've tried as many fixes and solutions that I could find and nothing is correcting what's happening. Even after deleting my hard drive and doing a clean install of Mavericks from a usb drive. I can use the computer for maybe a 1/2 hour and then it
-
Format calendar component times to "hh:mm a"
Hi all, I would like to format the calendar component time slots to "hh:mm a" (Example 01:30 AM), Is it possible? By default, caldendar component shows times in hh:mm (Example 24:00) format. regards, Jhon
-
Can't execute net use with CF9
On our win 2003 dev server we cfexecute a batch file which in turn calls another batch file, CONNECT.COM which temporarily connects to each of our production servers so that we can copy new files over to production using BeyondCompare. This has been
-
How to do keyframing in GarageBand ?
Hi there, Is it possible to do keyframing in GarageBand ? If yes, how to do it ? I want to keyframe the Left & Right Panning. Say at Time=10secs, I want the Panning to be at L=-48 and at T=22secs, the Panning is R=48, that means within the 12 secs th
-
Credit management exclusion for single item
HI sdners, my client requirement is that for a particular material he wants to exclude the credit check happening for all customers, where could be the setting and how to control it. thanks in advance.