how to add # symbol between day week month in java

Hi Experts,

i have a field called period
period = 00712**

Mins -00
Hours-7
Day -12
Month-*
week - *

some time it may have value instead of *
now from ui part i will get the value like - 00712**
in DB I have to insert like - 00#7#12#*#*
i have separate mins,hours,day,week,month and place with # symbol

Can some one suggest me how to do .
LVL 2
srikoteshAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Well you just need a format string and String.format

final String TIME_FORMAT = "%d#%d#%d#%d#%d";

...
String s = String.format(TIME_FORMAT,  mins, hours, day, week, month);

Open in new window

srikoteshAuthor Commented:
Hi CEHJ,

i am getting input as  00712**
why i have to  pass the args  in the above code second line

String s = String.format(TIME_FORMAT,  mins, hours, day, week, month);
why i have to pass the args as mins hours....

this line is showing error because i have to initialize these variables.
CEHJCommented:
why i have to  pass the args  in the above code second line
Because you will have to have parsed it to get the data anyway

some time it may have value instead of *
And what do 'week' and 'month' signify?
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

srikoteshAuthor Commented:
how to initialize  these args/variables

can u show some sample code.
CEHJCommented:
Not without your answering the questions i asked you, no
srikoteshAuthor Commented:
"some time it may have value instead of * means"
i may get the input like - 00712** or  
0071232 or *71232 or 0712*
there field called period from this i will get any one as input
srikoteshAuthor Commented:
"And what do 'week' and 'month' signify"

here week and month signifies * means = every

00712** = every month every week of day 12th 7 o clock  
Mins -00
Hours-7
Day -12
Month-*
week - *
CEHJCommented:
So it's a cron pattern? If so, if it's been stored in a db without separators, it will essentially be unparseable afaics
srikoteshAuthor Commented:
i am not sure which pattern it is.
database i have to store with separator #.
i have to insert  00#7#12#*#*
srikoteshAuthor Commented:
database i am storing with data type String.
CEHJCommented:
Sorry. That should have said:

If so, if it's been stored in the ui without separators, it will essentially be unparseable afaics
srikoteshAuthor Commented:
while displaying in ui  side
i am removing # symbols and showing to the user
CEHJCommented:
That's your mistake. The cron pattern is meaningless without separators

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
awking00Information Technology SpecialistCommented:
You certainly need the separators -
00111** = every month every week of day 1 at 11 o'clock  or every month every week of day 11 at 1 o'clock?
srikoteshAuthor Commented:
I've requested that this question be deleted for the following reason:

i haven't provided proper inputs to this question.it is not valid question
CEHJCommented:
i haven't provided proper inputs to this question.it is not valid question
That might be the case, but the people who have attempted to help you should not be unrewarded
CEHJCommented:
I can identify a solution: don't discard delimiters

There seems to be quite a fashion for devaluing the free work that people put into this site: one i'm watching very carefully
CEHJCommented:
eenookami, you answer my comment about free work being undervalued with an invitation to contribute more free work? Words fail me ...
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.