LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-10-2017, 05:16 PM   #16
ethaniz3d
LQ Newbie
 
Registered: Aug 2017
Posts: 8

Original Poster
Rep: Reputation: Disabled

Code:
#!/bin/bash
set -xv
StartDate=$(date -d "2 days ago" +%m/%d/%Y)
EndDate=$(date -d  "6 days ago" +%m/%d/%Y)


curl  --data "StartDate=${StartDate}&EndDate=${EndDate}&xmlfile=xmlfile"
solved it. If i changed the %y to a %Y, it gave me the 4 digit year. Thank you very much for all your help!
 
Old 08-10-2017, 05:29 PM   #17
michaelk
Moderator
 
Registered: Aug 2002
Posts: 16,014

Rep: Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848Reputation: 1848
Look at the man pages for the date command. There is lots of info on its formatting options. If you still can't find the answer post back
 
Old 08-10-2017, 05:36 PM   #18
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=14, FreeBSD_10{.0|.1|.2}
Posts: 4,454
Blog Entries: 6

Rep: Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394Reputation: 2394
Glad to hear that worked!

If your problem is resolved please use the Thread Tools feature at top of the thread to mark it as SOLVED so that others looking for a similar solution will more easily find what works.

And again, welcome to LQ!
 
Old 08-11-2017, 12:31 AM   #19
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 9,557

Rep: Reputation: 2810Reputation: 2810Reputation: 2810Reputation: 2810Reputation: 2810Reputation: 2810Reputation: 2810Reputation: 2810Reputation: 2810Reputation: 2810Reputation: 2810
Quote:
Originally Posted by ethaniz3d View Post
solved it. If i changed the %y to a %Y, it gave me the 4 digit year. Thank you very much for all your help!
If your problem is solved, please mark the thread solved.
Also, if you want to say thanks just click on yes.

Quote:
Originally Posted by ethaniz3d View Post
StartDate=$(date -d "2 days ago" +%m/%d/%Y)
EndDate=$(date -d "6 days ago" +%m/%d/%Y)
Finally - probably not important at all - StartDate is now "coming" 4 days after your EndDate
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing Curl result to a variable in a Bash script Entropy1024 Linux - Newbie 2 10-29-2015 03:50 PM
[SOLVED] Bash script: How to assign variable to an sqlite3 command with variable embedded? ninja6o4 Linux - Software 10 02-15-2015 04:43 PM
[SOLVED] bash won't search within a variable with a user imputed variable hoisu Programming 8 04-02-2014 12:11 PM
Pass contents of variable to curl command hattori.hanzo Programming 1 07-23-2013 01:09 AM
Bash variable problem: cURL -b parameter (string form e.g. "name=value;n2=v2") sithemac Other *NIX 3 07-09-2008 06:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration